Computing Atlas

How Computing Was Built
Sign In
Text size
100%
Theme
Algorithm

Binary Search Algorithm

Searching Algorithm

Binary search is a search algorithm that finds the position of a target value within a sorted array by repeatedly comparing the target to the array's middle element and discarding the half of the array that cannot contain it. Because each comparison eliminates half the remaining elements, the algorithm needs at most about the logarithm, base two, of the array's size in comparisons, far fewer than the linear scan a plain search over an unsorted list requires. An early refinement in the algorithm's own history is Hermann Bottenbruch's implementation, published in 1962, which removed an unnecessary equality check present in earlier versions and set the form most textbooks now teach. Binary search requires the array to already be sorted, which is the tradeoff against its speed: unsorted data must be sorted first, or searched by a slower linear method instead.

Facts
Time Complexity
Time Complexity (category)
Logarithmic Time -- O(log n) 1
Classification
Design Technique
Divide and Conquer 1
Connections

In Field

Source Binary search (Wikipedia)

Uses Design Technique

Sources
1. Binary Search Algorithm (Wikipedia)
  • Wikipedia infobox: time complexity logarithmic
    logarithmic
  • Wikipedia: design technique divide-and-conquer
    divide-and-conquer
View the Source
Binary search (Wikipedia)
  • In Field: Algorithms and Complexity Theory, Lead sentence
    binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array.
  • In Group: Searching Algorithms for Ordered Lists, Lead section
    finds the position of a target value within a sorted array
View the Source
Comments (0)
No comments yet. Be the first to share a thought.
Reader Challenges (0)
No disputes yet. Spotted an error or a better source? Open the first one.