CS367 Homework 7
Lecture 3, Fall 2015
Due by 11:59 pm on Friday, November 20 (not accepted late)

Announcements

Check here periodically.

11/13/2015  Homework assigned. To ask questions about the homework and see questions posed by other students and their answers, go to: https://piazza.com/wisc/fall2015/cs3673 and sign-in using your wisc.edu account.

Questions

Homework assignments must be done individually. Collaboration on homework assignments is not allowed.

Question 1:

All parts of this question refer to standard binary search trees. The next question will deal with red-black trees, but for this question assume you are using simple binary search trees with no extra balancing logic.

Part A: Show the binary search tree that results from inserting the following sequence of integers into a tree that is initially empty:

99   11   88   22   77   33   66   44   55

Part B: Show the binary search tree that results from inserting the following sequence of integers into a tree that is initially empty:

66   33   88   77   55   44   99   22   11

Part C: Show the binary search tree that results from deleting 66 from the tree in part B.

Part D: Show the binary search tree that results from deleting 33 from the tree in part B.

Question 2:

All parts of this question refer to red-black tree. If you are creating a text-file containing your solution, indicate red nodes by using square brackets around the value (e.g., [44] ) and indicate black nodes by not using any brackets around the value (e.g., 44 ). If you are creating your solution by hand on a piece of paper, indicate red nodes by drawing a square around the value and indicate black nodes by drawing a circle around the value.

Part A: Show the red-black tree that results from inserting the following sequence of integers into a tree that is initially empty:

99   11   88   22   77   33   66   44   55

Part B: Show the red-black tree that results from inserting the following sequence of integers into a tree that is initially empty:

66   33   88   77   55   44   99   22   11

Handing in

Please include your name at the top your file.

For this assignment you have two options for creating and submitting your answers:

  1. "draw" your trees in one file named Homework7 with the appropriate file extension, e.g., Homework7.pdf (see File Format for acceptable file formats), and electronically submit it to the Homework 7 Dropbox on Learn@UW, OR
  2. draw your trees by hand on a standard-sized sheet of paper, clearly print your name at the top of your paper, and turn in your paper in-class on Tuesday, August 4.
Last Updated: 11/13/2015     © 2014 Beck Hasti