It's a classic 3 way recursive solution.

```
class Solution(object):
def searchInsert(self, nums, target):
return self.BinarySearch(0,len(nums),nums,target)
def BinarySearch(self,start, end, list, target):
index = (start+end)/2
if start==end: return index
if target < list[index]:
return self.BinarySearch(start,index,list,target)
elif target > list[index]:
return self.BinarySearch(index+1,end,list,target)
else:
return index
```