Exact comparisons for min and max
You must find both the minimum and the maximum of distinct numbers using the fewest element comparisons. Work out the exact minimum number of comparisons that always suffices (not the ballpark - the precise integer).
Show hints (2)+
- Pair the numbers first: pair-offs split them into max-candidates and min-candidates.
- Then to reduce each group; total . Derive the , don't just quote .
Answer
Reveal answer →Final answer
148
Create a free account to see the full worked solution and track your progress.
Interview format: Hedge Fund Quant, Prop Trading