Rice University - Comp 212 - Intermediate Programming
Spring 2006
Lecture #32 - Design Patterns for Self-balancing Trees -
Insertion Algorithm
- Why do we need balanced trees?
- Trees offer much faster access than lists, but only
if the tree so long as all the branches are nearly the same length, i.e.
"balanced".
- A balanced tree gives O(log n) behavior, while lists
give O(n) behavior.
- Worst case scenario for an unbalanced tree is O(n)
behavior.
- Demo code
- Pre-Java 5.0 JRE/SDK:
- binaries in a jar
file (To run: java -jar
NTree.jar)
- source code, zipped
- Java 5.0-compatible JRE/SDK
- DrJava project
- Executable jar
file (To run: java -jar
dp4sbt_jre50.jar)
- PowerPoint Presentationn
- OOPSLA 2002 materials
- Paper in PDF format
- Poster (>740KB PNG file!)