Chapter 3 - Recursive Binary Search - doesn't work if item searched is at mid position
vidyabhandary opened this issue · comments
05_binary_search_recursive.py - fails for cases like these,
[1, 3, 5, 7, 9], target = 5
OR
[77, 95, 101, 255, 309, 570, 600], target = 255
A check needed before calling the method recursively.
if arr[mid] == target:
return arr[mid]