What is the maximum number of comparisons needed by binary search on a sorted list of 1024 items?

Answer and explanation

Correct answer: A. 11

  1. Step 1: Each comparison halves the list.
  2. Step 2: log2(1024) + 1 = 11.
Answer
11.
Why not the others: 512, 10 and 13 do not fit.

Practise more Python programming and algorithms.

Free questions with an explanation for every one, and full timed Saudi Secondary School Certificate mock tests.

What is the maximum… | Saudi Secondary School Certificate