Same question as
Why do we add 1 to the r + m in the last line ?[
^] with mostly same code.
m+1 is not alone it foes with other variables:
elif lst [ m] > key :
return bsearch2 ( lst , key , lo , m )
else :
return bsearch2 ( lst , key , m +1 , hi )
Think about the meaning if those variables in each call to
bsearch2.
Take a sheet of paper and a pencil, write a sorted list and simulate the meaning of each variables in the list as search is going on.