Binary search trees

Java applet visualizing numerous binary search tree; too bad you can't see it

This applet animates the functioning of several dictionary data structures. It can be used as a teaching aid or for self-study. By watching the visualization the user should more easily grasp the ideas behind the data structures.

standalone version for download


`To Start Press Any Key.'
Where's the ANY key?
Homer Simpson

The main parts

In the upper region there is a menu of trees you would like to visualize. You can choose either Binary Search Tree (BST), AVL tree, B tree, Red-black tree, AA tree, Skip list, Heap, Treap, Scapegoat tree, or Splay tree.


To insert, find or delete an element from a tree, write the input into the text field. (Input is an integer from 0 to 99 (inclusive); lower or greater numbers will be changed to 0 or 99.) Then press Insert, Find or Delete and the operation will start.

The animation pauses after each step of an algorithm. The step is commented on the right panel. You can proceed with the animation, by pressing the Next button.

If you don't want to watch the animation (you just want to make some changes to the tree) you can uncheck the Pause box.

The Clear button deletes whole tree, then Random button inserts 10 random numbers to the tree (you can use it to generate a random tree).

If you check the Small box, the applet will draw smaller trees. However, if you have high enough resolution, you may prefer the bigger version of the applet – trees won't fill your screen so quickly there.

Advanced usage


Statistics of the data structures are in the last line of the control panel.