Zurück

AVL Tree animation applet

 

Inputs
Only positive, single to double digit integers are allowed (e.g. "37" or "3"). Incorrect types of data are ignored by the applet.
Insert
Insert an integer in the binary tree. Node comparisons will appear in the bottom panel of the applet.
Search
Search for an integer in the binary tree. Node comparisons will appear in the bottom panel of the applet, including whether or not the requested node exists within the binary tree.
Delete
Delete an integer in the binary tree. Node comparisons will appear in the bottom panel of the applet, including whether or not the requested node can be deleted from the binary tree (i.e. if it exists within the tree or not).

NOTE: The current implementation is slow. You may be required to wait several seconds before the animation begins. This is a bug I plan to fix in the future.
BUGS: As many of you have pointed out the delete method does not rebalance the tree. The reason for this is that I use a regular binary tree delete. I wrote an AVL delete method but it has a memory leak (I know, java, garbage collection, go figure) so until I fix it it's regular binary tree delete for me.

Unless you would like to fix it. The source code for both my binary tree and AVL tree is here and you're welcome to it. If you find the bug, please let me know and I'll give tremendous fame by stating, right here, on this page, that you found the bug. I can't offer much more because, hey, I'm just a student.


Quelle: http://www.cs.jhu.edu/~goodrich/dsa/trees/avltree.html

Last Modified: Mon Jul 14 16:02:05 1997

John Kloss <jkloss@hops.cs.jhu.edu>