Binary Search
Binary Search
The divide and conquer search method.
Linear Search
The sequential searching through all data entries one by until until we find a match.
Time complexity is O(n).
The worstcase runtime of a linear search would be O(n).
Binary Search (Iterative)
Note: assumes that the array on which the search will take place is sorted in ascending order. We start in the middle of the data. If the result is our search term when we finish searching. If not, and is smaller than the target we repeat the process on the upper half of the data, otherwise if the middle is larger than the target search the lower half.
In each case we pick a new mid point and choose to search either the upper half or lower half of the data. This is of course much more efficient than an iterative.
The worstcase time complexity of a binary search is O(logn).
Binary Search (Recursive)

