Question discussion

[Added later – this question is not part of the original paper]What is the worst-case time complexity of binary search on a sorted array of…

359064Medium DSSSB TGT Computer Science 0 replies 0 views
0

[Added later – this question is not part of the original paper]

What is the worst-case time complexity of binary search on a sorted array of n elements?

  • AO(n)
  • BO(n log n)
  • CO(log n)
  • DO(1)
Correct answer: C

Explanation

Binary search halves the search range at every step, so it takes at most log₂ n comparisons: O(log n).

Discussion 0

Nobody has replied yet. Start the discussion!