Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. BST: Using the definitions on p. 1177 of our textbook for depth of a tree node and height of a tree, consider the set

1. BST: Using the definitions on p. 1177 of our textbook for depth of a tree node and height of a tree, consider the set of keys K = < 10, 4, 2, 8, 7 > and the different possible insertion orders for the keys in K. Based on the different possible insertion orders and their resulting Binary Search Trees, answer the following questions. (21 points)

a) What is the minimum height of a Binary Search Tree constructed from K? Show an insertion order for the keys in K that generates a Binary Search Tree of minimum height. Draw the corresponding Binary Search Tree.

b) Are there any other insertion orders (beyond what you found in (a) above) for the keys in K that produce a Binary Search Tree of minimum height? If so, provide one such sample insertion order and its accompanying Binary Search Tree.

c) What is the maximum height of a Binary Search Tree constructed from K? Show an insertion order for the keys in K that generates a Binary Search Tree of maximum height. Draw the corresponding Binary Search Tree.

2. For the set of keys given above in Problem 1, show the Binary Search Tree resulting from inserting the keys in the order given: K = < 10, 4, 2, 8, 7 >. Is it possible to color the resulting Binary Search Tree so that it becomes a red-black tree? Either prove that it is not possible or show a legal coloring that makes it a red-black tree. (15 points)

3. Chapter 13: For the set of keys given above in Problem 1, show the sequence of redblack trees that result after successively inserting the keys into an initially empty redblack tree in the order given: K = < 10, 4, 2, 8, 7 >. (Show one tree resulting from each insertion. State which case from the textbook applies. Assume that the root is always colored black.) (24 points)

4. Chapter 13: Starting from your answer to Problem 4, show the sequence of red-black trees that result after successively deleting the following sequence of keys (in this order) from the red-black tree: < 4, 8, 7 >. (Show one tree resulting from each deletion. State which case applies. Assume that the root is always colored black.) (20 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago