Algorithm · Point72 · Medium
Finding the Heaviest and Second-Heaviest Balls There are 32 balls, each with a different weight. In one operation, you can compare any two balls and determine which is heavier. What is the minimum number of comparisons needed to always identify the heaviest ball? What is the minimum number of comparisons needed to always identify both the heaviest ball and the second-heaviest ball? Give an algorithm that achieves the optimal number of comparisons, and state why the…
Checking your access…