AVL Trees and B Trees

AVL Trees and B Trees - CSC2100A Tutorial Trees AVL Trees...

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

View Full Document Right Arrow Icon
1 CSC2100A Spring 2006-2007 CSC2100A Tutorial Trees 2 Spring 2006/2007 AVL Trees, B-Trees
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 CSC2100A Spring 2006-2007 AVL Trees • An AVL (Adelson-Velskii and Landis) tree is a binary search tree with a balance condition. • An AVL tree is identical to a binary search tree, except that for every node in the tree, the height of the left and right subtrees can differ by at most 1. • With an AVL tree, all the tree operations can be performed in O(log n) time, except insertion.
Background image of page 2
3 CSC2100A Spring 2006-2007 Trees - AVL trees • LL (Single rotation): a node (k2) with left child (k1) k1 X Y k2 Z Y Z k1 X k2
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 CSC2100A Spring 2006-2007 Trees - AVL trees • RR (Single rotation): a node (k1) with right child (k2) Z Y k1 X Y X k2 Z k1 k2
Background image of page 4
5 CSC2100A Spring 2006-2007 Trees - AVL trees • LR (double rotation, at k1 first, then at k3) k1 A k3 D C D k2 k3 B C k2 A B k1
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 CSC2100A Spring 2006-2007 Trees - AVL trees • RL (double rotation, at k3 first, then at k1) k1 A C D k2 k3 A B k1 k3 D C B k2
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/28/2010 for the course CSC CSC1110 taught by Professor Cjyuan during the Fall '06 term at CUHK.

Page1 / 25

AVL Trees and B Trees - CSC2100A Tutorial Trees AVL Trees...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online