I have a recursion function insert which takes a sorted array and a temp value and appends the temp value to the right place.
insert
Example:
arr = [1,3,