hw3-solns

# hw3-solns - Illinois Institute of Technology Department of...

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

Illinois Institute of Technology Department of Computer Science Homework Assignment 3 Solutions CS 430 Introduction to Algorithms Spring Semester, 2009 Due: Wednesday, January 28 1. Problem 12.3-5 on page 264 Solution: The deletion operation is not commutative. A counterexample is shown as Figure 1 at the next page. Figure 1: Two deletions where the order of the operations matter 2. Problem 13.1-7 on page 277 Solution: Max ratio of red internal node to black internal node happens when the root height of the tree is odd, this will result in all nodes in the lowest level being red, resulting in maximum red internal nodes. This max ratio is equal to 2.

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

View Full Document
CS 430—Spring, 2009 2 Homework Assignment 3 Solutions The smallest possible ratio of red internal nodes to black internal nodes is 0. This can be achieved by letting all nodes in this tree black. 3. Problem 13.3-5 on page 287 Solution: When inserting a new node to a tree with at least a root, we Frst convert a leaf to a red internal node with 2 black leaves. If we have no violation to the rules, then we have a red node in the
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

hw3-solns - Illinois Institute of Technology Department of...

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

View Full Document
Ask a homework question - tutors are online