Binary search
1.Binary search
Choose an element in at the mid-point at a sorted list
Check whether it's smaller than or greater than the element you are looking for
2.Code
Iterative (take O (log n) time )
recursive (take O (log n) time, take recursive stack)
3.Complexity
The complexity is O(LogN)
Last updated