Worst Case scenario you will get in 3 steps

9 balls

Compare 1st:    1    2    3    | 4        5    6    | 7        8    9
if (first > second)
    //The ball is in 1st
Second compare :
    else (second > third)
    take the heavy one now you have 3 balls

Third compare :
    lets send is heaver then you have 3 balls (4, 5 , 6)
    Compare 4 to 5
        if both equals then heaver is 6th one or out of 4 & 5 one is heaver

*Subhransu Panigrahi
*
*Mobile:* *+91-9840931538*
 *Email:* [email protected]





> On Mar 25, 2:46 am, Lavesh Rawat <[email protected]> wrote:
> > *Weighing Problem Solution*
> > *
> > *There are 9 similar balls. Eight of them weigh the same and the ninth is
> a
> > bit heavier.
> > How would you identify the heavier ball if you could use a two-pan
> balance
> > scale only twice?
> >
> > Update Your Answers at : Click
> > Here<
> http://dailybrainteaser.blogspot.com/2011/03/25march.html?lavesh=lavesh>
> >
> > Solution:
> > Will be updated after 1 day
> >
> > Soln
> >
> > --
> > Posted By lavesh to brain teaser
> > solutions<
> http://solution-dailybrainteaser.blogspot.com/2011/03/25march.html>at
> > 3/25/2011 12:01:00 AM
> >
> > --
> >
> >                     "Never explain yourself. Your friends don’t need it
> and
> > your enemies won’t believe it" .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to