Let's say we let a hamster run in a 3-dimensional labyrinth.
The labyrinth has a certain number of chambers and a certain number of tunnels connecting the chambers. Each tunnel connects two chambers.
We let the hamster in from one end of the labyrinth and it must come out from the other one.
All the tunnels are one-way. Also, the chambers and tunnels are positioned, so that the hamster can never go back to a chamber it has already been to.
The program itself has to count how many possibilities the hamster has to get from the releasing chamber to the chamber with the exit from the labyrinth.
We know the number of the chambers and we know the number of the tunnels. Every chamber has a number, so the hamster starts from chamber number 1 and ends in the last (the highest) numbered chamber.
We also know the number data of the tunnels (from which chamber can the hamster move to which chamber).
For example:
What kind of guidelines should I follow while solving the problem?Chambers: 5
Tunnels: 6
Tunnels (A to B):
1 -> 2
1 -> 3
3 -> 4
4 -> 5
2 -> 3
3 -> 5
Thank you in advance!





Bookmarks