Binary Search
Appearance
This article is a stub. It might be missing pseudocode, complexity analysis, or a correctness sketch. It might need some other information which is incomplete perhaps.
Binary-Search
Binary-Search(A)
- mid = ⌊ (low + high) / 2 ⌋
- if A[mid] == v:
- return mid
- if v > A[mid]:
- low = mid + 1
- BINARY-SEARCH(A)
- else if v < A[mid]:
- high = mid - 1
Binary search is an algorithm concerned with the Searching Problem, aiming to be trivially the most fastest in terms of time execution. We assume the list to be ordered.