This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 80 35 46 20121 651 X 3. (a) Node 46 must become a right child of node 35. (b) Node 20 remains left child of 35 but moves up 1 level. (c) Balance factors are recomputed. AVL tree is balanced. 54 80 46 35 20 651 Double Rotations Insertion occurs in either: (1) In the right subtree of the left child of node X. or (2) In the left subtree of the right child of node X. (Node X is the node which becomes unbalanced) 1. Tree is unbalanced at node containing 8 due to insertion of node 5 into right subtree of left child of node 8. 12 16 8 6 52 141 +1 2 412 10 X 2. (a) Rotate X’s grandchild about X’s child (rotate 6 about 4). (b) Resulting tree is not AVL balanced. 12 16 8 2 52 142 4 612 10 X 3. (a) Rotate 6 about 8. (Rotate X’s new child about X.) (b) Tree becomes AVL balanced. 12 16 61 14 81 10 +1 X 2 5 4...
View
Full Document
 Summer '09
 Computer Science, Graph Theory, Tree structure, Child node

Click to edit the document details