Trees
and
their Implementation as Lists

trees
The Tree is a Pervasive Information Structure
Files and Directories
Family Trees
Organization Chart
(Management Hierarchy)
Decision Trees
Image Trees
Definition of Tree
Paths in Directed Graphs
Cycles
Cyclic and Acyclic
DAGs
Target Set
Leaves
Fan-In
Roots
Tree at Last
Tree vs Not
Classify these for Tree-dom
More Graphs to Classify
Reverse Graphs
Reconvergence, an Alternative
Subsets of Three Properties
Adding/Removing Arcs
Ordered Directed Graphs
Representing/Implementing
Trees as Lists
First Try: Target Sets
Target-Lists Representation
Nested Target-Lists Representation
Modified
Nested Target-Lists Representation
Testing leaf property
Representation of ÒUnlabelledÓ Trees
Exercise
Representing Lists by Ordered Trees
Representing Lists as Trees
Representing Lists as Trees
Representing Lists as Trees
Example: Binary Tree
Example: Binary Tree
Corresponding Box Diagram
Tree-Dichotomy for Recursion
Model Independence
Example Implementations
Recursion on Trees
Example: Height of a Tree
Searching Trees & Graphs
Searching a Labeled Tree
Searching a Labeled Tree
Depth-First Search
Depth- vs. Breadth- First
Breadth-First: Wavefront Analogy
Advantage of Breadth-First
Breadth-First
Searching a Labeled Tree
Searching Graphs vs. Trees
Depth- vs. Breadth- First in Graph
Searching Without Recursion
Searching a Maze
Recovering Path