AVL Trees Splay Trees

Roadmap

Balanced structures

AVL Tree

An AVL Tree Example

Balancing and Logarithms

Maintaining a Balance

Detecting Unbalanced Trees

Repair Method

Single rotation

S.R. Restructuring

Double rotation

D.R. Restructuring

Restructuring

Restructing cont'd

Restructuring summary

Insertion in an AVL

AVL Implementation

AVL Implementation

AVL Insertion Analysis

Removal from an AVL


  • Splay Trees

    Splay Tree

    Splaying

    Zig-Zig Splaying

  • Preserve the ordering...

    Zig-Zag Splaying

  • x,y and z are not "in line"

    Zig Splaying

    Insertion

    Insertion

    Analysis

    Amortized analysis

    Amortized Analysis

    Amortization Key

    Amortization for Splay Trees

    Proving the Amortized Cost

    Real Cost

    Savings Variation

    Zig-zig Proof

    Zig-zig Proof cont'd

    Zig-zag & Zig Proofs

  • Total cost:

    Wrapping Up the proof

    What is Left...