Question

1a) Draw the 2-3 tree that results when you insert the keys S E A R...

1a) Draw the 2-3 tree that results when you insert the keys S E A R C H X M P L Y in that order into an initially empty tree.

1b) Construct the corresponding left leaning red-black tree from part a.

1c) Find a sequence of keys to insert into a BST and a left leaning red-black BST such that the height of the BST is less than the height of the left leaning red-black BST, or prove that no such sequence is possible.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) Red/Black Tree

Step 1: Insert keys S & E        

Step 2: Insert key A                           

Step 3: Insert key R

Step 4: Insert key C                                                                

Step 5: Insert key H     

Step 6: Insert key X                                                                         

Step 7: Insert key M           

Step 8: Insert key P                                                                         

Step 9: Insert keys L                 

Step 10: Insert key Y            

Which is Required Red/Black Tree

b) Binary Search Tree

Step 1: Insert keys S & E        

Step 2: Insert key A                           

Step 3: Insert key R

Step 4: Insert key C                                                                

Step 5: Insert key H     

Step 6: Insert key X                                                                         

Step 7: Insert key M           

Step 8: Insert key P                                                                         

Step 9: Insert keys L                 

Step 10: Insert key Y       

Which is Required Binary Search Tree

In above BST and Red Black Trees the Height of Red black Tree is 3 and Height of BST is 5

Therefore Height of BST is not less than Height of Red black Tree

Add a comment
Know the answer?
Add Answer to:
1a) Draw the 2-3 tree that results when you insert the keys S E A R...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT