Recursion
Intro
"To understand recursion, you must first understand recursion."
The Tower of Hanoi
Wikipedia
This awesome animation.
Code
public void solve(int n, int fromBar, freeBar, toBar) {
solve(n-1, fromBar, freeBar, toBar);
move(fromBar, toBar);
solve(n-1, freeBar, fromBar, toBar);
}
Update on this
Last updated