Binary Search and AVL Trees

LA home
Computing
Algorithms
 glossary
 Binary Trees
  Search T'
  Tries
  PATRICIA
  Suffix Trees
 Tables
  Search & AVL

Insert and delete data (strings) into a binary search tree (BST) and an AVL tree using the input area and the `insert' and `delete' buttons in the HTML FORM below (change the names to protect the innocent). Note that space, ` ', is a valid character.

input=[  ]

NB. You can insert numerals into the tree but they will be sorted lexicographically (e.g. `10 < 9'), not numerically, under the current (string) coding. This is easy to change.

NB. The roots of the trees are at the left-hand-side of the large TEXTAREA. The trees are shown with links, and also in infix order, after each insertion or deletion. Balance of AVL (sub-)tree(s) is indicated by `|' (balanced), `^' (right taller) and `v' (left taller).

AVL Tree

An AVL (height balanced) tree is shown beneath the ordinary binary search tree in the HTML FORM above. It undergoes exactly the same sequence of insertions and deletions as the simple BST. Note that the AVL tree remains much shorter than the BST when, for example, alphabetically ordered names {a, b, c, d, ...} are inserted.

© L.A.
www:


© L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated),
Created with "vi (Linux or Solaris)",  charset=iso-8859-1,  fetched Sunday, 26-Mar-2017 03:23:16 EDT.

free: Linux, Ubuntu operating-sys, OpenOffice office-suite, The GIMP ~photoshop,
Firefox web-browser, FlashBlock flash on/off.