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.

Implement a compression <strong>and</strong> decompression scheme that is based on Huffman<br />

cod<strong>in</strong>g.<br />

P-12.5<br />

Create a class that implements a st<strong>and</strong>ard trie for a set of ASCII str<strong>in</strong>gs. The<br />

class should have a constructor that takes as argument a list of str<strong>in</strong>gs, <strong>and</strong> the<br />

class should have a method that tests whether a given str<strong>in</strong>g is stored <strong>in</strong> the trie.<br />

P-12.6<br />

Create a class that implements a compressed trie for a set of ASCII str<strong>in</strong>gs. The<br />

class should have a constructor that takes as argument a list of str<strong>in</strong>gs, <strong>and</strong> the<br />

class should have a method that tests whether a given str<strong>in</strong>g is stored <strong>in</strong> the trie.<br />

P-12.7<br />

Create a class that implements a prefix trie for an ASCII str<strong>in</strong>g. The class should<br />

have a constructor that takes as argument a str<strong>in</strong>g <strong>and</strong> a method for pattern<br />

match<strong>in</strong>g on the str<strong>in</strong>g.<br />

P-12.8<br />

Implement the simplified search eng<strong>in</strong>e described <strong>in</strong> Section 12.3.4 for the<br />

pages of a small Web site. Use all the words <strong>in</strong> the pages of the site as <strong>in</strong>dex<br />

terms, exclud<strong>in</strong>g stop words such as articles, prepositions, <strong>and</strong> pronouns.<br />

P-12.9<br />

Implement a search eng<strong>in</strong>e for the pages of a small Web site by add<strong>in</strong>g a pagerank<strong>in</strong>g<br />

feature to the simplified search eng<strong>in</strong>e described <strong>in</strong> Section 12.3.4.<br />

Your page-rank<strong>in</strong>g feature should return the most relevant pages first. Use all<br />

the words <strong>in</strong> the pages of the site as <strong>in</strong>dex terms, exclud<strong>in</strong>g stop words, such as<br />

articles, prepositions, <strong>and</strong> pronouns. P-12.10 Write a program that takes two<br />

character str<strong>in</strong>gs (which could be, for example, representations of DNA str<strong>and</strong>s)<br />

<strong>and</strong> computes their edit distance, show<strong>in</strong>g the correspond<strong>in</strong>g pieces. (See<br />

Exercise C-12.15.)<br />

Chapter Notes<br />

The KMP algorithm is described by Knuth, Morris, <strong>and</strong> Pratt <strong>in</strong> their journal article<br />

[64], <strong>and</strong> Boyer <strong>and</strong> Moore describe their algorithm <strong>in</strong> a journal article published the<br />

same year [15]. In their article, however, Knuth et al. [64] also prove that the BM<br />

algorithm runs <strong>in</strong> l<strong>in</strong>ear time. More recently, Cole [23] shows that the BM algorithm<br />

makes at most 3n character comparisons <strong>in</strong> the worst case, <strong>and</strong> this bound is tight. All<br />

of the algorithms discussed above are also discussed <strong>in</strong> the book chapter by Aho [3],<br />

albeit <strong>in</strong> a more theoretical framework, <strong>in</strong>clud<strong>in</strong>g the methods for regular-expression<br />

788

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

Saved successfully!

Ooh no, something went wrong!