previous up next
Go backward to Example
Go up to Top
Go forward to Example
RISC-Linz logo

Levels and Heights

Definition: The level of a node x in a tree is the length of the path from the root of the tree to x:

levelT(x) := length(p) where p =
   such p: p is path in T /\  p is path from root(T) to x.

The height of a tree is the maximum level of its nodes:

height(T) := max {levelT(x): x in V} where V = T0.

Root has level 0; level of every other node is one plus the parent level.


Author: Wolfgang Schreiner
Last Modification: January 26, 2000

previous up next