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.

That is, if we th<strong>in</strong>k of the set of keys stored at v as <strong>in</strong>clud<strong>in</strong>g the special fictitious<br />

keys k 0 = − ∞ <strong>and</strong> k d = +∞, then a key k stored <strong>in</strong> the subtree of T rooted at a child<br />

node v i must be "<strong>in</strong> between" two keys stored at v. This simple viewpo<strong>in</strong>t gives<br />

rise to the rule that a d-node stores d − 1 regular keys, <strong>and</strong> it also forms the basis<br />

of the algorithm for search<strong>in</strong>g <strong>in</strong> a multi-way search tree.<br />

By the above def<strong>in</strong>ition, the external nodes of a multi-way search do not store any<br />

entries <strong>and</strong> serve only as "placeholders," as has been our convention with b<strong>in</strong>ary<br />

search trees (Section 10.1); hence, a b<strong>in</strong>ary search tree can be viewed as a special<br />

case of a multi-way search tree, where each <strong>in</strong>ternal node stores one entry <strong>and</strong> has<br />

two children. In addition, while the external nodes could be null, we make the<br />

simplify<strong>in</strong>g assumption here that they are actual nodes that don't store anyth<strong>in</strong>g.<br />

Figure 10.19: (a) A multi-way search tree T; (b)<br />

search path <strong>in</strong> T for key 12 (unsuccessful search); (c)<br />

search path <strong>in</strong> T for key 24 (successful search).<br />

628

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

Saved successfully!

Ooh no, something went wrong!