In-Lab 4--Building Red-Black Trees
Due: at the end of lab
Objective: Practice building Red-Black trees
Applet to use to check your work.
Just in case that one doesn't work:
Build these Red-Black trees
- 8, 5, 12, 3, 2, 1
- 1, 2, 3, 4, 5, 6, 7, 8
- 30, 20, 40, 35, 37
- 82, 75, 98, 60, 79, 80, 65, 62
- 48, 76, 27, 52, 87, 50, 51, 92, 49, 90
- 4, 2, 6, 5, 7, 16, 15, 14, 13, 12, 8, 10
Hand in:
Hand in your diagrams of trees, showing the rotations, reasonably neat.
It is expected that every diagram will be correct, since you can check it
with the applets.
OutLab Due on Thursday at the beginning of lab class.
Use the code I have given you for Red/Black trees and implement the delete method.
- The algorithm is in your book.
- If needed it should handle color changes and rotations if the balance is knocked off after a deletion.
- Add a inorder print method also, you should have already written this in a previous lab.
- Turn in the code by email at the beginning of Thursday's lab class.