Question 11Asked in DSSSB TGT Computer Science (Technical), 1 Aug 2021, Shift 3

What is the maximum running time of binary search algorithm, when n = 12,000?

  1. A12
  2. B13
  3. C14
  4. D15
Show answerHide answer

Correct answer: (C) 14

Explanation

Binary search needs at most ⌊log₂n⌋ + 1 comparisons. 2¹³ = 8192 ≤ 12000 < 16384 = 2¹⁴, so ⌊log₂12000⌋ = 13 and the maximum is 14.

From DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3

This is question 11 of DSSSB TGT Computer Science PYQ (Technical), 1 Aug 2021, Shift 3. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.