This preview shows page 1. Sign up to view the full content.
Unformatted text preview: e height of a tree is one more than the
greatest number of ancestors of any node. An element ( call it a node) immediately above
another node is called the parent of those nodes
immediately below, which are called the children
of the node above. Also called the depth (although that term is often
used just for nodes)
used just for nodes). The terms ancestor and descendant are also
used to indicate relative position in the tree. Now that we've got some terms, let's see if we
can define what a tree is.
It turns out to be a recursive definition. 1 Here is an example of a tree:
A tree is defined as follows R • an empty tree, one with no nodes, is a tree L L L subtree • a single node is a tree
• the structure formed by taking one or more
trees and a single node not in any other tree
and making that node the parent of all the
roots of the other trees is a tree LL L
L L L LL L L One special form of tree is called a
It is a tree with the extra property that a node
may not have more than 2 children.
View Full Document