AVL Tree Demonstration


Instructions:

  • Enter an integer (or a sequence of integers separated by commas) in the field and press <Enter> to insert new nodes.
  • To insert a random integer, press the Ins Random-button. You can also insert several random integers at once by typing the number of integers you want to insert in the field and then press Ins Random.
  • To delete an integer, select the node by clicking it and press the Del-button.
  • To search for an integer, enter an integer in the field and press the Find-button. If the node exists, it will automatically be selected.
  • Find Min and Find Max selects the smallest and the largest integer respectively.
  • Automatic rotations: When checked, the rotations will be performed automatically when the tree breaks the AVL property*. You can press the Replay-button to watch the last insertion in slowmotion.
    When unchecked, the animation will freeze when the tree breaks the AVL property. The nodes that break the property will be marked red, and you will have to press the Rotate-button to perform the necessary rotation. You can press Replay if you want to see the rotation again.
  • You can zoom in/out using the slider. You can scroll the tree by pressing the mousebutton anywhere in the tree-window and drag.


    * for every node in the tree, the height of the left and right subtree may only differ by one at most

© 2001 Anders Stenberg, Sebastian Olsson, Nils Svensson, Mattias Stridsman, MT1c