- Thinking recursively
- Recursion with linked lists
- Tail recursion
- Some more examples with recursion
Textbook Chapter 14
void hanoi(int n, int src,
int dest, int spare) {
if (n == 1) {
cout << "Move disk from " << src
<< " to " << dest << endl;
} else {
hanoi(n-1, src, spare, dest);
hanoi(1, src, dest, spare);
hanoi(n-1, spare, dest, src);
}
}