Binary Search
Algorithm
Given a sorted list:
Select the element in the middle of the list.
Compare the middle element to the element to be searched
If the element is smaller than the middle element, repeat at 1. with left partition.
If the element is greater than the middle element, repeat at 1. with right partition.
If the element is equal to the middle element, the element has been found so stop.
Worst case:
Best case:
Average case:
Space complexity:
Implementations
fuss/algorithms/searching/binary_search.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1