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.

A <strong>Java</strong> implementation of the BM pattern match<strong>in</strong>g algorithm is shown <strong>in</strong> Code<br />

Fragment 12.3.<br />

Code Fragment 12.3: <strong>Java</strong> implementation of the<br />

BM pattern match<strong>in</strong>g algorithm. The algorithm is<br />

expressed by two static methods: Method BMmatch<br />

performs the match<strong>in</strong>g <strong>and</strong> calls the auxiliary method<br />

build LastFunction to compute the last function,<br />

expressed by an array <strong>in</strong>dexed by the ASCII code of the<br />

character. Method BMmatch <strong>in</strong>dicates the absence of a<br />

match by return<strong>in</strong>g the conventional value − 1.<br />

755

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

Saved successfully!

Ooh no, something went wrong!