Smallest number of groups to sniff The question given: The sniffer dog at the airport stops beside a trolley piled high with 60 suitcases. One of the suitcases contains contraband peanuts. The dog can tell whether peanuts are hidden in any one of a group of suitcases, but it gets tired if it has to do too much sniffing.
What is the smallest number of groups of suitcases it must sniff in order to isolate the suitcase with the peanuts?
My reasoning: Divide the 60 into 2 groups of 30 suitcases. Make the the dog sniff both of the groups. Divide the group of 30 that the dog identifies into 2 groups of 15. Make the dog sniff both of the groups. Divide the group that the dog identifies into 8 and 7. 8 will lead to the maximum sniffs so lets say the dog identifies the group with 8. Divide that group into 2 groups of 4 (dog again sniffs 2 groups). Then the resulting group into 2 groups of 2 until finally we are left with 2 groups of 1.Then, the dog sniffs both of them and identifies the once with peanuts. 
I counted and got 12 groups to sniff. Why is the answer 6?  

At each split the dog doesn't need to sniff both groups. If its not in the one the dog sniffed it must be in the other group. So you've done twice as much as needed.
So your reasoning/thinking is correct just your "code" is inefficient. :)
