Question
Please show how to complete these 2 questions: We will assume that any empty node boxes are non-existent nodes. For each of these problems, print
Please show how to complete these 2 questions:
We will assume that any empty node boxes are non-existent nodes. For each of these problems, print out a copy of the blank tree and fill in the answers for the question. Please make sure to write the question number and your name on the sheet. If you know how to annotate PDF files directly, you can also do that instead of printing off the trees (this may be easier since you will have to submit a digital version of your solutions).
Question 1:
Show the binary search tree built by adding the following numbers in this specific order, assuming the tree is empty to start with: 30, 63, 2, 89, 16, 24, 19, 52, 27, 9, 4, 45 (You may need to add more boxes to the diagram).
Question 2
The trouble with binary search trees is that they can become unbalanced depending on the order in which you insert values. Give an order for inserting the letters P, A, I, F, W, Q, N, X, E, C, G, S, B, Z such that your intermediate trees as well as the resulting tree are complete binary search trees. Please provide the resulting binary search tree along with the order. (Hint: it might be helpful to first draw the full/complete tree to figure out how the values must be arranged, then you can determine the order in which to insert them.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started