11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

432 Chap. 13 Advanced Tree <strong>Structures</strong>acdghnheuoo$teicercktaldosrstaloke$$$fie$e$epnsre$h$$$(a)acdgh$antntealchickenedeeruduckago<strong>at</strong>ol ogoldfishgoosehorseante<strong>at</strong>erantelope(b)Figure 13.2 Two vari<strong>at</strong>ions on the alphabet trie represent<strong>at</strong>ion for a set of tenwords. (a) Each node contains a set of links corresponding to single letters, <strong>and</strong>each letter in the set of words has a corresponding link. “$” is used to indic<strong>at</strong>ethe end of a word. Internal nodes direct the search <strong>and</strong> also spell out the wordone letter per link. The word need not be stored explicitly. “$” is needed torecognize the existence of words th<strong>at</strong> are prefixes to other words, such as ‘ant’ inthis example. (b) Here the trie extends only far enough to discrimin<strong>at</strong>e between thewords. Leaf nodes of the trie each store a complete word; internal nodes merelydirect the search.

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

Saved successfully!

Ooh no, something went wrong!