Trees

Each tab displays an interactive binary tree diagram that allow you to insert and remove values in various trees, and see what the resulting tree looks like:

The node sizes are fixed, so these trees work best with simple data: single letters, numbers with no more than 2 digits. The trees automatically detect letters vs numbers, so there is no need to put quotes around letters. Be consistent with the tree contents.

You may insert or remove values at any time, and the trees update accordingly. BSTs, AVLs, and RBTs allow only one occurrence of a value in the tree. PTs update the value count in the node.

Insertions can be done on single values or multiple, comma-delimited values.

Written in SVG and Javascript.

To Do:

  • Update to contoured trees. The current width of a tree or subtree is the same whether their levels are filled or not. This means that badly balanced trees may be unreadably wide.
  • Add animation to insertion, removal, and retrieval. Now you can see the results of an insertion or removal, but not the process.