CSE 326: Data StructuresLecture #10Balancing Act andWhat 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)
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
Email: owner-cse326@cs.washington.edu
Home Page: http://www.cs.washington.edu/326/
Download presentation source