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

Create successful ePaper yourself

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

The correctness of algorithm suffixTrieMatch follows from the fact that we<br />

search down the trie T, match<strong>in</strong>g characters of the pattern P one at a time until<br />

one of the follow<strong>in</strong>g events occurs:<br />

• We completely match the pattern p.<br />

• We get a mismatch (caught by the term<strong>in</strong>ation of the for loop without a<br />

break out).<br />

• We are left with characters of P still to be matched after process<strong>in</strong>g an<br />

external node.<br />

772

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

Saved successfully!

Ooh no, something went wrong!