Chapter 11 Exercise Solutions

advertisement
Java Software Solutions, 4th Edition
Exercise Solutions, Ch. 11
Chapter 11 Exercise Solutions
EX 11.1.
Draw the binary search tree that results from adding the following integers
(34 45 3 87 65 32 1 12 17). Assume our simple implementation with no balancing
mechanism.
EX 11.2.
Starting with the result from Exercise 11.1, draw the tree that results from
removing (45 12 1), again using our simple implementation with no balancing
mechanism.
EX 11.3.
Repeat Exercise 11.1, this time assuming an AVL tree. Include the balance
factors in your drawing.
Answer on following page.
©2014 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Java Software Solutions, 4th Edition
Exercise Solutions, Ch. 11
©2014 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Java Software Solutions, 4th Edition
Exercise Solutions, Ch. 11
EX 11.4.
Repeat Exercise 11.2, this time assuming an AVL tree and using the result
of Exercise 11.3 as a starting point. Include the balance factors in your drawing.
EX 11.5.
Repeat Exercise 11.1, this time assuming a red/black tree. Label each node
with its color.
Answer not provided.
EX 11.6.
Repeat Exercise 11.2, this time assuming a red/black tree and using the
result of Exercise 11.5 as a starting point. Label each node with its color.
Answer not provided.
©2014 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Java Software Solutions, 4th Edition
Exercise Solutions, Ch. 11
EX 11.7.
Starting with an empty red/black tree, draw the tree after insertion and
before rebalancing, and after rebalancing (if necessary) fo the following series of
inserts and removals.
Answer not provided.
EX 11.8.
Repeat Exercise 11.7, this time with an AVL tree.
Answer not provided.
©2014 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Download