Go backward to Example Go up to Top Go forward to Example |
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.