CSE 326: Data Structures Lecture #10 Balancing Act and What AVL Stands For

1/28/00


Click here to start


Table of Contents

CSE 326: Data Structures Lecture #10 Balancing Act and What AVL Stands For

Today’s Outline

Beauty is Only ?(log n) Deep

Balance

AVL Tree Dictionary Data Structure

Testing the Balance Property

An AVL Tree

But, How Do We Stay Balanced?

Beautiful Balance

Bad Case #1

Single Rotation

General Single Rotation

Bad Case #2

Double Rotation

General Double Rotation

Insert Algorithm

Easy Insert

Hard Insert (Bad Case #1)

Single Rotation

Hard Insert (Bad Case #2)

Single Rotation (oops!)

Double Rotation (Step #1)

Double Rotation (Step #2)

AVL Algorithm Revisited

Single Rotation Code

Double Rotation Code

Double Rotation Completed

AVL

Bonus: Deletion (Easy Case)

Deletion (Hard Case #1)

Single Rotation on Deletion

To Do

Coming Up

Author: Steve Wolfman

Email: owner-cse326@cs.washington.edu

Home Page: http://www.cs.washington.edu/326/

Download presentation source