What is the time complexity of binary search on a sorted array?

Practice Questions

1 question
Q1
What is the time complexity of binary search on a sorted array?
  1. O(n)
  2. O(log n)
  3. O(n log n)
  4. O(1)

Questions & Step-by-step Solutions

1 item
Q
Q: What is the time complexity of binary search on a sorted array?
Solution: Binary search divides the array in half with each step, leading to a time complexity of O(log n).
Steps: 9

Related Questions

Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely