The Department of Computer Science & Engineering
STUART C. SHAPIRO: CSE 116 B
If a node, n is on the path between the root and a node m, then n is an ancestor of n and m is a descendant of n. Nodes with a common parent are siblings. The length of a path between a node and one of its descendants counts the number of nodes on the path less one.
The level of a node is the length of the path from it to the root. The height of a tree is the maximum level of any of its nodes.
Every node is the root of its own subtree, consisting of it and all its descendants.
Recursively, a tree is either empty, or consists of one root node with zero or more subtrees.
For most trees, every node has some value, although some trees have only their leaves having values.
Stores a dictionary.
The characters on any path from the root to any node represents an
initial substring of some word.
The characters on any path from the root to a starred node represents a word in the dictionary.
Note it takes 12 nodes to store the 5 words: a, ball, be, car, case
and 9 more nodes to add the additional 6 words: at, are, art, been, bell, cart---less than linear growth of space!
Another way to look at it: every one of the 8 leaves represents a
word: at, are, art, ball, been, bell, cart, case.
The other 3 words (a, be, car) are free. Every word that can be formed by an initial substring of another word is stored for free.
For example the
search tree of a reduced Boggle board:
|Small Boggle Board||Partial Search Tree|