Searching
Last updated
Was this helpful?
Last updated
Was this helpful?
Time Complexity: O(n)
Binary search works only on a sorted set of elements.
Using Recursion:
Time Complexity: O(log n)
If all the names in the world are written down together in order and you want to search for the position of a specific name, binary search will accomplish this in a maximum of 35 iterations.
Linear Search < Binary Search