next up previous contents
Next: Tree Traversals: tree Up: 3240 Previous: Factorial: fact   Contents

Trees: ADT [50]




\begin{picture}(714,193)(20,646)
\thicklines\put(560,820){\circle{28}}
\put(480,...
...{\makebox(0,0)[lb]{\raisebox{0pt}[0pt][0pt]{\twlrm next sibling}}}
\end{picture}



Implementation 1: each node needs an array of pointers.

Implementation 2: each node only needs two pointers.

Applications: hierarchies, directories

Depth of a node: length of path from root to node.

Root is at depth 0.

Height of a node: length of longest path from node to leaf.

All leaves have height 0.

The height of the root is the height of the tree.



Subsections

Ted Billard 2001-10-25