This should be done in 2 iterations...keep 3 in each hand...higher weight indicates the heavier marble is in that set...now with 3 marbles select 2...if weights are equal then the marble kept aside is the heavier
This should be done in 2 iterations...keep 3 in each hand...higher weight indicates the heavier marble is in that set...now with 3 marbles select 2...if weights are equal then the marble kept aside is the heavier one..
2 iterations. Take any 4 out of 6 and weigh 2 vs 2. If it is equal, weigh the other 2 as 1vs 1 and find the heaviest. If the 2 v 2 is uneven, take the uneven marbles and weigh them as 1 vs 1 and find the heaviest one.
first think of how many bits do you need to detect the number of logic 1s in an 8 bit input. highest number will be 8. so you need 4 bits to represent that. how can you compute this value though? the optimal way i think to do this problem is to look at the properties of a full adder. there are 3 inputs (A, B, and Cin) and 2 outputs (S and Cout). You can hook each input of a full adder to a bit value. Therefore, what you end up having is 3 full adders FA0 to compute b0(A) + b1(B) + b2(Cin), FA1 to compute b3(A) + b4(B) + b5(Cin), and FA2