Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Latest commit

 

History

History
19 lines (9 loc) · 731 Bytes

File metadata and controls

19 lines (9 loc) · 731 Bytes

10 - Binary search

  • Binary search is a search algorithm that finds the position of a target value within a sorted array.

  • It compares the target value to the middle element of the array.

  • If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found

  • O(log n) in the best case and O(n) in the worst case.

Materials


09 - Linear search | Home | 11 - Interpolation search