25.11.2014 Views

Algorithms and Data Structures

Algorithms and Data Structures

Algorithms and Data Structures

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.

N.Wirth. <strong>Algorithms</strong> <strong>and</strong> <strong>Data</strong> <strong>Structures</strong>. Oberon version 188<br />

END<br />

a<br />

b<br />

a b c<br />

Fig. 4.47. Representation of BB-tree nodes<br />

Considering the problem of key insertion, one must distinguish four possible situations that arise from<br />

growth of the left or right subtrees. The four cases are illustrated in Fig. 4.48.<br />

1.<br />

A A B<br />

a<br />

B<br />

a b c<br />

b<br />

c<br />

B<br />

2.<br />

A B<br />

A B<br />

C<br />

A<br />

C<br />

a<br />

b<br />

C<br />

a b c<br />

d<br />

a<br />

b c<br />

d<br />

c<br />

d<br />

3.<br />

B<br />

A<br />

B<br />

A<br />

B<br />

A<br />

c<br />

a<br />

b<br />

c<br />

a b c<br />

a<br />

b<br />

B<br />

4.<br />

B<br />

C<br />

A<br />

B<br />

C<br />

A<br />

C<br />

A<br />

c<br />

d<br />

a<br />

b<br />

c<br />

d<br />

a<br />

b c<br />

d<br />

a<br />

b

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

Saved successfully!

Ooh no, something went wrong!