01.04.2015 Views

Sequence Comparison.pdf

Sequence Comparison.pdf

Sequence Comparison.pdf

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.

32 2 Basic Algorithmic Techniques<br />

Once algorithm LCS LENGTH reaches (m,n), the backtracking information retained<br />

in array prev allows us to find out which common subsequence contributes<br />

len[m,n], the maximum length of an LCS of sequences A and B. Figure 2.13 lists the<br />

pseudo-code for delivering an LCS. We trace back the dynamic-programming matrix<br />

from the entry (m,n) recursively following the direction of the arrow. Whenever<br />

a diagonal arrow “↖” is encountered, we append the current matched letter to the<br />

end of the LCS under construction. Algorithm LCS OUTPUT takes O(m + n) time<br />

in total since each recursive call reduces the indices i and/or j by one.<br />

Figure 2.14 backtracks the dynamic-programming matrix computed in Figure<br />

2.12. It outputs 〈A,L,G,T 〉 (the shaded entries) as an LCS of<br />

〈A,L,G,O,R,I,T,H,M〉<br />

and<br />

〈A,L,I,G,N,M,E,N,T 〉.<br />

Fig. 2.14 Backtracking process for finding an LCS of 〈A,L,G,O,R,I,T,H,M〉 and<br />

〈A,L,I,G,N,M,E,N,T〉.<br />

2.5 Bibliographic Notes and Further Reading<br />

This chapter presents three basic algorithmic techniques that are often used in designing<br />

efficient methods for various problems in sequence comparison. Readers can<br />

refer to algorithm textbooks for more instructive tutorials. The algorithm book (or<br />

“The White Book”) by Cormen et al. [52] is a comprehensive reference of data structures<br />

and algorithms with a solid mathematical and theoretical foundation. Manber’s

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

Saved successfully!

Ooh no, something went wrong!