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.

if such a path can be traced. The details of the pattern match<strong>in</strong>g algorithm are<br />

given <strong>in</strong> Code Fragment 12.7, which assumes the follow<strong>in</strong>g additional property on<br />

the labels of the nodes <strong>in</strong> the compact representation of the suffix trie:<br />

If node v has label (i,j) <strong>and</strong> Y is the str<strong>in</strong>g of length y associated with the path<br />

from the root to v (<strong>in</strong>cluded), then X [j − y + 1. .j] =Y.<br />

This property ensures that we can easily compute the start <strong>in</strong>dex of the pattern <strong>in</strong><br />

the text when a match occurs.<br />

Code Fragment 12.7: Pattern match<strong>in</strong>g with a suffix<br />

trie. We denote the label of a node v with<br />

(start(v),end(v)), that is, the pair of <strong>in</strong>dices<br />

specify<strong>in</strong>g the substr<strong>in</strong>g of the text associated with v.<br />

771

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

Saved successfully!

Ooh no, something went wrong!