SUNY Geneseo Department of Computer Science
{Date}
CSci 141, Spring 2005
Prof. Doug Baldwin
Typo? Last line on page 439 should read "...or is in each of T-prime's children..."
Section 13.3 through 13.3.4
Binary trees can maintain sorted collections
"Inorder" property:
Inductions on height of tree
Proof by contradiction
Traverse algorithm visits no node twice and makes exactly n visits
Moral: trees can support fast "database" operations
Algorithms for adding an item (insertion) and finding an item (search)
Start inserting from greatest element
![[A "Tree" that Is a List to the Left]](unbalanced.gif)
What sort of induction do the proofs in this reading use?
![[Subtrees Each Have Distinct Heights]](heights.gif)
traverse()
if ! this.isEmpty()
this.getLeft().traverse()
process this.getRoot()
this.getRight().traverse()
How would you derive the number of primitive tree messages this sends to traverse a tree of n items?
Recurrence relation
Observation: actual distribution of n1 and n2 doesn't seem to matter
Mini-assignment: find closed form for an "easy" version of recurrence