«« Next » « Previous
«« Next » « Previous

Link Details

No hanging chads here, we promise! Login and vote now.
Link 95478 thumbnail

By kbilsted
via firstclassthoughts.co.uk
Published: Jul 16 2008 / 07:13

Is your mind like every one else in computer science?? or are you able to solve this small logic puzzle?? most people in computer science gets this one wrong! You have been warned!
  • 63
  • 7
  • 6044
  • 3138

Comments

Add your comment
User 278342 avatar

philpill replied ago:

1 votes Vote down Vote up Reply

I bet the reason most people get it wrong (me included) is 'cos they assume you can only fit one ball per bowl ...

User 246188 avatar

kbilsted replied ago:

1 votes Vote down Vote up Reply

point taken. I've just changed the text. But just reading the first subsequent section should tell you that that was possible.

User 252611 avatar

Thierry.Lefort replied ago:

0 votes Vote down Vote up Reply

hum ... my guess is that most CS student already know the answer as it is a basic logic problem and a great programming exercise ...
But I prefer the other harder version which is : you have the same equipment as earlier but you have 12 balls and one of them is either lighter or heavier, you only can use the balance 3 times and you have to tell which ball is different AND if it is lighter or heavier.

First, try to find a solution(there are more than one), then write the program that will find all the solutions ! (It was my Prolog final exam!)

Have a lot of fun ;-)

User 246188 avatar

kbilsted replied ago:

0 votes Vote down Vote up Reply

WOW the idea with the prolog program sounds fun. But I guess it's easily doable in any programming language. I know of the 12 ball problem, but I was saving it for a later post... if you want to send me any prolog code or other code, please email me LOL

User 252611 avatar

Thierry.Lefort replied ago:

0 votes Vote down Vote up Reply

héhé ... it was 10 years ago while I was a CS student ...
But it would be fun to try again I guess ;-)

User 293051 avatar

tanesha.net replied ago:

0 votes Vote down Vote up Reply

And, I got it wrong because I did not assume that the remaining 7 balls are of equal weight (8 are identical looking, but one is heavier, why would the 7 then be identical weight? :) )

Cheers,
Soren

User 315217 avatar

ADanto6840 replied ago:

0 votes Vote down Vote up Reply

,tanesha.net hit the nail on the head - you *MUST* make it clear that 7 balls are equally weighted and an 8th ball is heavier, otherwise if the other 7 'identical' looking balls are different weights your answer changes.

User 246188 avatar

kbilsted replied ago:

0 votes Vote down Vote up Reply

thanks for pointing this out. I'll fix it ASAP. Hope you had fun with it despite that flaw :)

User 311881 avatar

stugots replied ago:

0 votes Vote down Vote up Reply

"Pick any 2 balls and compare these against each other, e.g. {1} against {2}. If the scale balances, you know it is ball 3 is the heavier."

WRONG. Ball 3 could be heavier than either ball 1 or ball 2, but NOT heavier than ball 1 and 2 combined. This quiz is flawed.

User 311881 avatar

stugots replied ago:

1 votes Vote down Vote up Reply

Sorry, never mind, I misread the quiz! I'm flawed!

User 246188 avatar

kbilsted replied ago:

0 votes Vote down Vote up Reply

LOL glad to hear.. self searching has never hurt anyone :)

User 207620 avatar

tgautier replied ago:

0 votes Vote down Vote up Reply

Agree with Thierry - this problem is often called "12 coins" where the challenge is a bit harder. Took me two days to solve 12 coins the first time I saw it years ago. Of course you can google it for a solution - I think there are about three total solutions.

User 311517 avatar

thetoolman replied ago:

0 votes Vote down Vote up Reply

The site is down for me, but I found the question in google cache:

This is one of my favorite questions to ask people. Primarily computer science people, as they always get this one wrong :-)

The problem is quite simple. You are given 8 identical-looking balls, one of which is heavier than the other 7. Using an old-fashioned mechanical scale you must identify the heavier ball using the scale as few times as possible. The scale is constructed using two bowls and an arm enabling the bowls to either balance or have one bowl rising while the other (and heavier bowl) falling. You can't just add one ball at a time thinking its one weighing, however, you may put any number of balls in each bowl... All you need to solve the puzzle is to use a bit of common sense.

How many weighings are required to identify the heavier ball?
Figure caption: How many weighings are required to identify the heavier ball?

User 186901 avatar

kenallen999 replied ago:

0 votes Vote down Vote up Reply

Are you joking - this takes about 10 seconds of thought.
Weigh 3 balls against 3 balls - if they are equal - weight the two remaining balls against each other
- or - if one set of three balls is heavier select two of the three and weigh them against each other, if they are equal it is the 3rd ball of that set.,
,

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.