Binary Search Comparisons for 1024 Elements

Coding
Search
Easy
A target is known to be present in a sorted array of 1024 distinct elements. What is the minimum worst-case number of yes/no comparisons required to identify its position?
Hint 1

Each yes/no comparison can at best halve the number of remaining candidate positions.

Hint 2

Find the smallest with .

Show worked solution
  1. 1. Relate comparisons to halving the search space

    Each comparison partitions the remaining candidates into two roughly equal halves, so comparisons can distinguish at most positions.

  2. 2. Solve for k

    Since exactly, ten comparisons suffice and are necessary in the worst case.

Answer: 10

Related roles: Browse quant jobs

Related problems