There are 64 stones of different weights no two stones weigh
There are 64 stones of different weights (no two stones weigh the same). Find, in 94 weighings on a balance scale, the heaviest and the lightest of the stones.
Solution
First we assign first two values to the min and max.
Then we will iterate through the each stones and compare their weights in pairs: If weighti > weighti+1 then we can compare ith stone with max valued stone and (i+1)th stone with min valued stone. So by this technique we are doing 3 weighing per pair.
So number of comparisons will be = 1 + 3* (n-2)/2 (if n is even)
= 1 + 3 * 62/2
= 94 comparisons.
