This animation introduces the data structure Binary Tree.
First the structure of a binary tree is shown and the terms (inner)
node, root, leaf, level, path, path length defined.
Following that the possibilities of traversing a binary tree are presented.
Pre-Order
Here the root of the subtree is processed first before going into
the left then right subtree.
In-Order
After the complete processing of the left subtree the root is
processed followed by the processing of the complete right
subtree.
Post-Order
The root is processed only after the complete processing of the
left and right subtree.
Level-Order
Using a queue the tee is processed by levels. So first all nodes
on level i are processed from left to right before the first node of
level i+1 is visited.
The complete source code is shown for each mode of traversing the
tree. In each step the current command is highlighted using
colours.