DS-chapter4(AVL Tree)

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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
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

This note was uploaded on 02/16/2011 for the course CS 136 taught by Professor Yuechen during the Winter '08 term at Zhejiang University.

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 Right Arrow Icon
Ask a homework question - tutors are online