Question: Question 1 : 2 5 points A valid Red - Black tree should possess the following properties: Every node is either red or black. The
Question : points
A valid RedBlack tree should possess the following properties:
Every node is either red or black.
The root is black.
Every leaf is NULL and black.
If a node is red, then both its children are black.
All paths from a node to any leaf have same number of black nodes in between ie their BlackHeight is the same
After insertion of a new key to the tree, properties and may be violated causing the tree to be become unbalanced. These violations can be overcome by rotating the tree around certain nodes and updating their colors, as described in the slides.
a points Consider the RedBlack Tree given above. Insert the key into it Which cases from the slides are you going to encounter? What rotations would you need to overcome these problematic cases? What will the final tree look like? Explain your answer.
Note: You must show the final state in picture and also explain which violation caused you to use which rotation on which node as your progressed through the rebalancing of the tree
b points Asymptotic cost of inserting a new key to a redblack tree is Why? Explain your answer by showing the math.
c points Where would you use redblack trees? Why?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
