Lecture 4: Recursive Data Structures
Background Material
- Lecture 2
- Recursion and induction
- Pointers and linked lists
Reading
- Chapter 5 (material on binary trees and binary search trees) of the text.
Topics
- Recursive Definition of a binary tree
- Height
- Maximum number of nodes
- Path length
- Recursive algorithms for binary trees
- Number of nodes
- Height
- Path length
- External representation of binary trees
- reading
- printing
- pretty printing
- Recursive Definition of a binary search tree
- Recursive algorithms for binary search trees
- search
- insert
- max
- delete
- traversal
- Runtime analysis of binary search trees
- maximum runtime (height)
- average runtime (internal path length)
Lecture Notes
Programs
- tree.c,
tree.h - algorithms for binary
and binary search trees.
- treeinsert.c - main program to
test tree algorithms.
- randbst.c - main program to
analyze performance of tree algorithms. This requires the files
perm.h and
perm.c.
Resources
Assignments
Created: Oct. 20, 2004 by jjohnson@cs.drexel.edu