This week's book giveaways are in the Java EE and JavaScript forums. We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line! See this thread and this one for details.

There are at most n-1 fake coins that are either lighter or heaver than the real coin. Note: each coin can be heavier or less than the real coin and they are not the same weight.

post an algorithm that will determine the real coin

Steve Fahlbusch wrote:now just be clear, the above can not be solved, but....

provide a constraint so that your algorithm will work.

eg: given that all fake are larger, or all fake are smaller or half have are larger and half fake are smaller.

The constraint determines the algorithm.

Are you expecting an algorithm that solves the puzzle in full generality?

e.g.

The initial problem with that would be to identify all the assumptions that make a difference to the algorithm. I'm certainly not saying that first step is insurmountable. However, I don't currently see an obvious way to know when you've covered all the possibilities.

I could see starting with a few different sets of assumptions, working out the algorithm for each and then trying to identify the common structure of the algorithm and the parts that rely on the assumptions.

By the way, I'm still thinking about this problem from time to time, but I haven't really put pencil to paper yet.