hw1 - assuming the node containing 60 is deleted from the...

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

View Full Document Right Arrow Icon
COP 3530 – Homework Problems #1 – Summer 2002 Due Monday June 10 th at class time. 1. Shown below is a BST which is unbalanced. Use the DSW algorithm to create a perfectly balanced version of this tree. Show all intermediate steps in both the creation of the backbone as well as the rotations that will occur to convert the backbone into the perfectly balanced tree. 2. For the AVL tree shown below, perform the necessary rotations to balance the tree assuming a new node containing 35 is inserted into the tree. For each rotation that is required identify the type of rotation, i.e., right, left, or double. Show the balance factors at every node before and after the rotation. Draw the resulting AVL tree. 45 40 55 25 15 35 85 30 38 70 65 60 3 2 6 2 4 8 3 5
Background image of page 1

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

View Full DocumentRight Arrow Icon
3. For the AVL tree shown below, perform the necessary rotations to balance the tree
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: assuming the node containing 60 is deleted from the tree. For each rotation that is required identify the type of rotation, i.e., right, left, or double. Show the balance factors at every node before and after the rotation. 4. For the red-black tree shown below, determine the type of imbalance that will occur if a new node containing 70 is inserted into the tree. Perform and describe the action that must be performed to rebalance the tree in this case. 40 20 50 30 60 80 4 3 6 3 5 1 2 3 9 9 9 9 9 5. For the red-black tree shown below, determine the type of imbalance that will occur if the node containing 70 is deleted from the tree. Perform and describe the action that must be performed to rebalance the tree in this case. 60 40 70 30 80 85 20 50 90...
View Full Document

This document was uploaded on 06/13/2011.

Page1 / 3

hw1 - assuming the node containing 60 is deleted from the...

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

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