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 DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: As the restructuring may upset the balance of a node higher in the tree, we continue checking for balance until the top is reached. Example 1 remove 32 This is not an AVL tree. It needs to be restructured. find x, y, and z The result, in this case, is a balanced tree; the height of all children differ by at most 1. Example 2: removal of the root Remove 62 Find the right most node in the left child of the node to be removed and move it to fill the hole. Implementation Each node stores left, right, and parent. Also, storing the neighbor in each node speeds of the test for restructuring. Insert, find, and remove always have O (log n ) in AVL trees compared to O( n ) in lists and hash tables (in the word case)....
View Full
Document
 Fall '08
 Staff
 Data Structures

Click to edit the document details