Animating Algorithms

Rotations on Binary Search Trees

To illustrate a few of the features available, consider the two insets below.

These panels illustrate a repeating sequence of rotations on nodes of a binary tree. On the left, we present a rather standard representation of the tree; on the right, the nodes are laid out to emphasize their inorder (sorted) ordering (which is relevant in this case, since rotations do minor surgery on binary search trees while preserving inorder ordering). Various other features are present to illustrate how the tree is traversed during an operation (the small ball) and to focus on the nodes where these operations are applied (the spotlight). The animations also provide menus for changing these and other properties.

Also feel free to point, click and tug on them a bit!

Additional operations

The links above will take you to several demos, which construct an initial tree, perform a few generic operations, and then allow you to manipulate the resulting structures (insert, locate and delete elements). Menus are provided to change aspects of the animation - the node representation, presence or absence of labels, and tree layout and physics. When labels are not display, you can always click on a node to query its contents. There are just a few basic rules.

Doug Ierardi and Ta-Wei Li, with the assistance of Cavit Aydin, Steven Deng, Craig Kawahara, Susanto Kolim and Jack Tsou