Tuesday, December 8, 2009

Help TorNador! Create Magic!

Hey folks,
This week is awesome. I am finished with all my exams, and have been enjoying my time. This week has been high for placements at the college and I am expecting a lot more people getting jobs in the coming days.
Ok, coming back to the issue of discussion. Once again, Kapil Garg and Aditya Nema chipped in with their gritty insights and divided the cake equally into two parts. Kapil supplemented his solution with a mathematical proof, while Aditya relied on logic to crack the puzzle.

Any plane passing through the middle of a cuboid divides it in two equal parts. We can consider the given cake as combinaton of two cuboids, a full cuboid and the hole being a cuboid of negative weight. Now, the plane through the two centres simultaneously give you the solution. If you still want a more convincing proof, try proving it for a 2-D geometry and you can extend it to 3-D. And yeah, I am always there if you still need some more details on the solution.

Ok, this week I had been going through Rabin-Karp string algorithm. A single pass through the string can let you manipulate the string well. It uses application of hashing technique. Hence, O(N) being the runtime, the algorithm lets you perform fast, infact very fast operations. The only drawbacks being that it cannot be applied to very long string. I would suggest the computer programmers to go through it once for sure. This section has it explained well. Try applying it to test whether a string is palindrome or not.

Ok, well for others, I do have a puzzle.

TorNador is an old and famous magician. Due to his age, he keeps forgetting the tricks for magics. He has a bag with 10 white balls, and 8 black balls. He calls one person from the audience and asks him to perform the following operations successively.
1. Take two balls out from the bag.
2. If the balls are of same colour, put a black ball inside the bag, else put a white ball back.

You can assume that there is an infinite supply of both white and black balls and hence the person can always put a ball back in the bag.

When one ball is left in the bag, the person asks Tornador the colour of the ball. Help TorNador give the answer. If you think the answer is not definite, give the expected value of the last ball being white.

Would be back in the weekend...
Till then help TorNador and keep puzzling :)
Vivek
nitkkr.vivek@gmail.com

2 comments:

  1. will tentatively post by 2moro morning.. seems like a healthy question though .

    ReplyDelete
  2. Please dont post the answer on the blog, or it kills the interest of solving the puzzle, for others.
    Do mail the answer.

    Regards,
    Vivek

    ReplyDelete