hakk

software development, devops, and other drivel
Tree lined path

Binary Search

Binary Search is a searching algorithm for finding an element’s position, if it exists, in a sorted array.

Implementation

Complexity

Time Complexities

  • Best case complexity: O(1)
  • Average case complexity: O(log n)
  • Worst case complexity: O(log n)

Space Complexity

The space complexity of the binary search is O(1).