There's this friend of mine, who has coded this problem in 'C' (His net is down temporarily - so I got a soft copy of the prog), without adopting the above mentioned approach, infact he has used a very simple approach. Yet, it works.

If 'h' r the no. of Humans & 'c' the no. of cannibals entered as I/P (provided h>c, at the time of I/P), the program consistently gives the Solution in : 'h+c-1' steps.

can u xamine the code & tell me, is this also a valid implementation.

Attached Files
File Type: zip (33.4 KB, 8 views)