DEPTH-FIRST SOLUTION FOR THE MISSIONARY-CANNIBAL PROBLEM
Three missionaries and three cannibals come to the bank of a river they wish to cross. There is a boat that will hold only two people and any of the group can row it. If there are ever more missionaries than cannibals on any side of the river the cannibals will get converted. Devise a series of moves to get everyone across the river with no conversions.
No comments:
Post a Comment