Binary Search
Things to consider
Search Range and Loop Condition
When and how to change the bounds
// Initially
L R
v v
[ inLeft ] [ !inLeft ]
// Finally
R L
v v
[ inLeft ] [ !inLeft ]What's the result
Examples
Comparisons between L <= R and L < R
L <= R and L < RSolution 1. Binary Search (L <= R)
Solution 2. Binary Search (L < R)
Other notes
Problems
Last updated