Skip to content

Latest commit

 

History

History
41 lines (27 loc) · 2.19 KB

File metadata and controls

41 lines (27 loc) · 2.19 KB

Binary Search

Theory

Binary Search

  • Binary search is a search algorithm that finds the position of a target value within a sorted array.

Binary Search Applications

  • Binary search is used to quickly find a value in a sorted sequence (consider a sequence an ordinary array for now).

Binary Search Implementation

  • Using a loop.
  • Using recursion.

Binary Search Time Complexity

  • Access: O(1)
  • Search: O(log n)
  • Insertion: O(n)
  • Deletion: O(n)

Binary Search Space Complexity

  • O(1)

Problems

Category: Binary Search Status: Done Author: David Bujosa