23.11.2014 Views

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

Data Structures and Algorithms in Java[1].pdf - Fulvio Frisone

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figures 10.30 <strong>and</strong> 10.31 show a sequence of <strong>in</strong>sertion operations <strong>in</strong> a red-black<br />

tree.<br />

Figure 10.30: A sequence of <strong>in</strong>sertions <strong>in</strong> a redblack<br />

tree: (a) <strong>in</strong>itial tree; (b) <strong>in</strong>sertion of 7; (c) <strong>in</strong>sertion<br />

of 12, which causes a double red; (d) after<br />

restructur<strong>in</strong>g; (e) <strong>in</strong>sertion of 15, which causes a<br />

double red; (f) after recolor<strong>in</strong>g (the root rema<strong>in</strong>s<br />

black); (g) <strong>in</strong>sertion of 3; (h) <strong>in</strong>sertion of 5; (i) <strong>in</strong>sertion<br />

of 14, which causes a double red; (j) after restructur<strong>in</strong>g;<br />

(k) <strong>in</strong>sertion of 18, which causes a double red; (l) after<br />

recolor<strong>in</strong>g. (Cont<strong>in</strong>ues <strong>in</strong> Figure 10.31.)<br />

647

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!