Recall & Review
beginner
What is the main goal of the Tower of Hanoi problem?
To move all disks from the source peg to the destination peg following the rules: only one disk can be moved at a time, and a larger disk cannot be placed on top of a smaller disk.
Click to reveal answer
beginner
What are the three pegs called in the Tower of Hanoi problem?
Source peg (where disks start), Auxiliary peg (used for temporary storage), and Destination peg (where disks must be moved).
Click to reveal answer
intermediate
Explain the recursive approach to solve the Tower of Hanoi problem.
Move n-1 disks from source to auxiliary peg, move the nth (largest) disk to destination peg, then move n-1 disks from auxiliary to destination peg recursively.
Click to reveal answer
intermediate
What is the minimum number of moves required to solve the Tower of Hanoi problem with n disks?
The minimum number of moves is 2^n - 1, where n is the number of disks.
Click to reveal answer
beginner
In C, what is the base case for the recursive Tower of Hanoi function?
When n (number of disks) is 1, move the disk directly from source to destination and return.
Click to reveal answer
What is the first step in the recursive solution of Tower of Hanoi for n disks?
✗ Incorrect
The recursive solution starts by moving n-1 disks from the source peg to the auxiliary peg.
How many moves does it take to solve Tower of Hanoi with 3 disks?
✗ Incorrect
Minimum moves = 2^3 - 1 = 7 moves.
Which peg is used as temporary storage in Tower of Hanoi?
✗ Incorrect
The auxiliary peg is used as temporary storage to help move disks.
What condition must be followed when placing disks on pegs?
✗ Incorrect
Only one disk can be moved at a time, and a larger disk cannot be placed on a smaller disk.
What is the base case in the Tower of Hanoi recursive function?
✗ Incorrect
When n = 1, move the disk directly and stop recursion.
Describe the steps to solve the Tower of Hanoi problem recursively for n disks.
Think about breaking the problem into smaller parts.
You got /3 concepts.
Explain why the minimum number of moves for Tower of Hanoi is 2^n - 1.
Consider how moves increase as disks increase.
You got /3 concepts.