previous | start | next

Level Order Traversal

The level number (or depth) of a node in a binary search tree is the distance from the root.

Level order means to list the keys in order by their level and for keys on the same level, list them from left to right (that is, in increasing order).

Listing ALL the keys in a binary search tree in their usual order doesn't give any information about the shape of the tree. Is it balanced, essentially a linked list, or what?

However, if the keys are listed in level order you can use this as the INPUT order to rebuild the original tree! So instead of drawing binary search trees they can be described by giving the level order list of keys.



previous | start | next