## CS367 Homework 4
| ||||||||||

## QuestionsHomework assignments must be done individually. Collaboration on homework assignments is
What do I need to answer? - 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:55 44 33 22 11 66 77 88 99 **Part B:****Show the binary search tree**that results from inserting the following sequence of integers into a tree that is initially empty:66 44 88 11 77 99 55 22 33 **Part C:****Show the binary search tree**that results from deleting 44 from the tree in part B using the.*in-order predecessor***Part D:****Show the binary search tree**that results from deleting 66 from the tree in part B using the.*in-order successor*
- 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:55 44 33 22 11 66 77 88 99 **Part B:****Show the red-black tree**that results from inserting the following sequence of integers into a tree that is initially empty:66 44 88 11 77 99 55 22 33 -
**Part A:**Assume that a priority queue is implemented using aheap.**max****Show the contents**of the max heap array that results from enqueuing (inserting) the following sequence of integer priorities into a heap that is initially empty:6 44 20 27 73 34 10 22 89 Assume the array begins with 10 elements. Show your final answer in the form of an array, not as a binary tree, leaving any unused array slots blank. **Part B:**Assume that a priority queue is implemented using aheap and the following shows the contents of the array, with slot 0 going unused:**min**3 20 7 24 41 15 32 56 72 **Show the contents**of the min heap array after three dequeue (removeMin) operations are done. Show your final answer in the form of an array, not as a binary tree, leaving any unused array slots blank.
| ||||||||||

## Handing inPlease include your name at the top your file.
For this assignment you have a variety of options for creating and submitting your answers. You may draw your trees and arrays in an ordinary text file, using characters to form boxes and arrows (just as was done in the early days of computing). You may use a figure drawing tool as found in Word, Powerpoint, and numerous other programs. Then submit the figures as an ordinary pdf file. You may also draw your trees and arrays by hand on a standard-sized sheet of paper;clearly print your name
at the top of your paper.
Then scan or photograph your answer sheet into a pdf or jpg file.
Name your answer file Homework4 with the appropriate file extension, e.g., Homework4.pdf
or Homwwork4.txt.
Electronically submit your work to the Homework 4 Dropbox on Learn@UW. | ||||||||||

Last Updated: 8/25/2017 © 2014-17 Beck Hasti and Charles Fischer |