Jump to content

Binary Search

From Encyclopedia of Algorithms
Revision as of 01:24, 5 August 2026 by Aitzaz (talk | contribs) (Create introductory stub ob binary search.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)
  1. mid = ⌊ (low + high) / 2 ⌋
  2. if A[mid] == v:
  3. return mid
  4. if v > A[mid]:
  5. low = mid + 1
  6. BINARY-SEARCH(A)
  7. else if v < A[mid]:
  8. 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.