How do we find the second heaviest and third heaviest balls? We have 25 balls. We can compare them 5 by 5 and it will sort them from the heaviest to the lightest. we can only compare 7 times.
CodePudding user response:
Pick any 5 balls then weigh them against another group of 5 balls. Take the heaviest group and keep all 10 compared balls separate. Do this twice. After 2 5v5 ball comparisons, we compare the groups that were the heaviest and keep the heavier group. Then we compare this heavier group with the remaining 5 balls, we keep whichever group is heaviest. We have done 4 comparisons so far, we use the 5th by separating the heavy group into 2 balls and 3 balls that we weigh against eachother. The 2nd and 3rd ball will be in one of the groups depending on the weight comparison outcome. Good luck! <3