Questions / Quant development, Algorithms & structures
Halve the search space
A search starts with 1,024 candidates and each ideal split halves the remaining set. How many halvings leave one candidate?
Answer it in the app It's free. You get hints, a second try if you miss, and a follow-up question.
Show the answer and worked solution
Answer: 10 halvings
- 1,024 = 2¹⁰, so ten halvings leave one. This counts halvings, not every possible implementation’s comparison count.
Interview shortcut. Halvings to 1 = log₂ n = log₂ 1,024.
In the app this has a follow-up where one thing about the setup changes. Try the follow-up.