1 / 7

Black node

11. Insert 4 into this R-B Tree. 14. 2. 15. 1. 7. 5. 8. Red node. Black node. Insertion Practice. Insert the values 2, 1, 4, 5, 9, 3, 6, 7 into an initially empty Red-Black Tree. case 1. 2. 2. 2. 2. 1. 1. 4. 1. 4. 1. 4. 5. 5. case 2. case 3. 2. 2. 2. 1. 4. 1. 5.

renee
Download Presentation

Black node

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 11 Insert 4 into this R-B Tree 14 2 15 1 7 5 8 Red node Black node UMBC CSMC 341 Red-Black-Trees-1

  2. Insertion Practice Insert the values 2, 1, 4, 5, 9, 3, 6, 7 into an initially empty Red-Black Tree UMBC CSMC 341 Red-Black-Trees-1

  3. case 1 2 2 2 2 1 1 4 1 4 1 4 5 5 case 2 case 3 2 2 2 1 4 1 5 1 5 5 2 2 4 9 4 9 2 9 3 1 5 1 5 1 5 4 9 4 7 4 9 3 3 6 6 9 3 6 7 Constructing a RB tree by inserting 2, 1, 4, 5, 9, 3, 6, 7 2

  4. 65 50 80 10 70 90 60 62 Perform the following deletions, in the order specified Delete 90, Delete 80, Delete 70 UMBC CSMC 341 Red-Black-Trees-2

  5. case 2

  6. case 1 50 65 65 rotate 50 about 65 Recolor 50 and 65 50 70 10 65 50 V+ 60 60 10 V+ 60 10 case 3 case 4 62 62 62 50 Rotate62 about 65 recolor 62, 65 and 60 Rotate62 about 60 recolor 62 and 60 10 65 62 V+ 60 50 10 62 60 65

More Related