|
|
Re: Please help me with the following question
Posted:
Mar 7, 2013 2:09 PM
|
|
lol, I really didn't think my answer would have stumped you. Here is a simpler version. Split the group into two groups of 6, keep the heavier group, split that into two groups of 3 keep the heavier group, weight (any) 2 coins from the remain group of 3, if they weigh the same then the other coin is the hevier one, if not then the heavier one is the heavier one.
It is a binary search.
Bob Hansen
On Mar 7, 2013, at 11:33 AM, Joe Niederberger <niederberger@comcast.net> wrote:
>> Your problem is (fairly) well defined and the answer is a binary search. > >> "Binary Search" usually refers to an algorithm that finds a specific member of an ordered (sorted) random-access array. That's not the setup here. > > Or, a bit more precisely, an indexed set with direct access via ordered index, values sorted by index. For indices i,j; i > j => v(i) > v(j) (or vica versa). > > Cheers > Joe N
|
|