DS-chapter4(AVL Tree)

# DS-chapter4(AVL Tree) - [email protected] TA f...

This preview shows pages 1–5. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: [email protected] TA: f , [email protected] project f : ftp://ds_student:[email protected] 4.4 AVL Trees Target : Speed up searching (with insertion and deletion) Tool : Binary search trees root small large Problem : Although T p = O( height ), but the height can be as bad as O( N ). AVL Trees . Example . 3 binary search trees obtained for the months of the year Nov Oct Sept May Mar June July Dec Aug Apr Feb Jan July June Mar May Oct Sept Nov Jan Feb Aug Apr Dec Entered from Jan to Dec A balanced tree Average search time = ? 3.5 Average search time = ? 3.1 What if the months What if the months are entered in are entered in alphabetical order? alphabetical order? AST = 6.5 AST = 6.5 AVL Trees Adelson-Velskii-Landis (AVL) Trees (1962) Adelson-Velskii-Landis (AVL) Trees (1962) Definition S An empty binary tree is height balanced. If T is a nonempty binary tree with T L and T R as its left and right subtrees, then T is height balanced iff (1) T L and T R are height balanced, and (2) | h L- h R | 1 where h L and h R are the heights of T L and T R , respectively....
View Full Document

{[ snackBarMessage ]}

### Page1 / 11

DS-chapter4(AVL Tree) - [email protected] TA f...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online