by Sarnaz Hossain
Algorithmic Puzzles
1 - The River:
In computer science getting your hands dirty and having a go are both essential skills that you learn as core principles that can lead to immense satisfaction when solving problems. Therefore in classic computer science student fashion I have decided that, instead of going in depth about the different strategies you can take to tackle a problem, I would propose a scenario. Hopefully, with the aid of some computational thinking you as the reader will have a go at solving the puzzle and see how a computer scientist would tackle problems to a much greater complexity when programming but still with the same key principle in mind, of giving it a good old go. In addition to this, of course, there will be a solution at the end of the article. Have fun and solve problems!
The Issue:
You are a farmer, and you find yourself at the edge of a riverbank. With you, you have a wolf, a goat and a head of cabbage. You also have access to one boat but of course you can only take one thing when crossing the river on the boat. However, the problem is that if you leave the wolf and the goat unattended the wolf will eat the goat and if you keep the goat and the cabbage unattended the goat will eat the cabbage. Your job as the farmer is to transport all individual items (not an item inside another item) safely to the other side of the river?. Is this possible if yes how, if not why?
The Solution:
The solution to this problem is quite a simple one in the end. Firstly, the man would have to transport the goat to the other side. Then transport the wolf but importantly this is when the word “unattended” comes into things as it means that if you as the farmer are present nothing will be harmed or eaten. This means swaps can occur. Therefore, when transporting the wolf across the river when you reach the final side of the river you swap the goat who is at the destination with the wolf and take the goat back to the initial side of the river. Then back at the initial side, swap the cabbage and the goat, leaving the goat at the start and then transport the cabbage to be at the end with the wolf. Then finally, take the poor goat who has been on too many journeys and is feeling seasick across the river and there the problem has been solved.
As this is the first edition of Algorithmic Puzzles, I have decided to keep it simple and sweet but as I discover more interesting and more challenging problems the more, I will share here. This River problem is included in the Alcuin Collection, which is one the earliest collections of mathematical problems in Latin.
Comments
Post a Comment
Comments with names are more likely to be published.