Advanced Programming I Lecture Notes

Advanced Programming I Lecture Notes

14 March 2006 • Balancing Trees


Outline

A Question

Data Insertion Order

Tree Levels

Tree Shape

Example Tree Shapes

Getting Well-Shaped Trees

Rebalancing Trees

Node Rotations

Example Rebalancing

an example rebalancing

AVL Trees

AVL Rotations

AVL Balance

Almost-Balanced Trees

Red-Black Trees

The Red-Black Property

Example Red-Black Tree

Maintaining Almost Balance

Abandoning Balance

Caching

A List Cache

Caching Tree Accesses

Splay Trees

Splaying


This page last modified on 16 March 2006.

This work is covered by a
Creative Commons License.