|
|
|
 |
 |
 |
|
Recursion with Web Animations
|
|
|  |
The Animation of Recursion
This is a Web site that offers animations of recursive methods. The solution code is traced as the animation is happening.
The site does not explain recursion, but it includes Java applets that demonstrate the solutions to six problems: Money Collector (a divide-and-conquer problem), Factorial, String Reversal, QuickSort, Towers of Hanoi, and Eight Queens.
The Animation of Recursion
Tower of Hanoi
This applet has several controls that allow you to select the number of disks and control the speed of the solution. You can also choose to solve the puzzle by dragging disks from one peg to another, following the rules. You can drop a disk on to a peg when its center is sufficiently close to the center of the peg. The applet expects you to move disks from the leftmost peg to the rightmost peg.
The recursive solution is explained and recurrence relations are discussed.
Tower of Hanoi
Towers of Hanoi
This is simply a game animation of the Towers of Hanoi.
Objects First
The N By N Queens Problem
In chess, a queen can move as far as she pleases, horizontally, vertically, or diagonally on the board. The goal of this problem is to determine how to place eight queens on an ordinary chess board so that none of them can hit any other queen in one move.
This is an advanced lesson involving backtracking, but great fun to watch and discuss!
The N By N Queens Problem
|
|
|
|
|
|