My Docs
BlogGithubLinkedin
Data Structures & Algorithms
Data Structures & Algorithms
  • Data Structures & Algorithms
  • trees
    • 🌳Trees
    • Page 1
      • Breadth-First Search (BFS)
  • 🕸️Graph
    • Graphs
    • ⛓️Linked List
    • Binary Search
    • Linear Search
Powered by GitBook
On this page
  • Binary Search
  • Complexity
  • References

Was this helpful?

Edit on GitHub
  1. Graph

Binary Search

PreviousLinked ListNextLinear Search

Last updated 3 years ago

Was this helpful?

Binary Search

In computer science, 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. Binary search compares the target value to the middle element of the array; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until it is successful. If the search ends with the remaining half being empty, the target is not in the array.

Binary Search

Complexity

Time Complexity: O(log(n)) - since we split search area by two for every next iteration.

References

🕸️
Wikipedia
YouTube