|
|
Definition 7.13 (Tree)
V \ { root } is connected to one
other node p called the parent of c.
G is a tree T.
Definition 7.14 (Child)
A node may have zero or more children, but every node other the root has exactly one parent.
Definition 7.15 (Ancestor, Descendant)
>
be a path in a tree T with
= root.
The
nodes
1
i < k, are called an
ancestor of
and the node
, 1
i < k,
a descendant of
node
Definition 7.16 (Siblings)
Definition 7.17 (Leaf)
Definition 7.18 (Height and Depth)
In a tree T the height of a node n is the length of a longest path from n to a leaf. The height of a tree is the height of the root. The depth, or level, of a node n is the length of the path from the root to n.
Definition 7.19 (Labeled Trees)
Definition 7.20 (Subtree)
We define binary trees recursivly as follows:
Definition 7.21 (Binary Tree)
If r is a node and
and
are binary trees,
then is the tree with root r, left subtree
and
right subtree
is a binary tree.
Definition 7.22 (Binary Search Tree)
Examples:
|
|
Last modified: 27/July/98 (12:14)