Back

ⓘ Binary tree




Binary tree
                                     

ⓘ Binary tree

  • In a balanced binary tree the left and right branches of every item differ in height by no more than 1.
  • In a perfect binary tree all interior items have two children and all leaves have the same depth or same level. A perfect binary tree is also a full and complete binary tree.
  • In a full binary tree every item has either 0 or 2 children.
  • In a complete binary tree every level, except possibly the last, is completely filled, and all items in the last level are as far left as possible.
                                     

1. Traversals

Pre-order

The current item is visited, then the left branch is visited, and then the right branch is visited.

In-order

The left branch is visited, then the current item is visited, and then the right branch is visited.

Post-order

The left branch is visited, the right branch is visited, and then the current item is visited.