Download BONFACE ISIAHO ASILIGWA P58/75814/2012 ASSIGNMENT III

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Network motif wikipedia , lookup

Structural alignment wikipedia , lookup

Transcript
BONFACE ISIAHO ASILIGWA
P58/75814/2012
ASSIGNMENT III Design and Analysis of Algorithms
1. Time complexity of the bottom-up string alignment algorithm.
Time complexity of string alignment algorithm = O(MN) for general or large sequences
(where N and M is the length of two strings )
Proof Using the Needleman-Wunsch algorithm
Step 1. Initialize the matrix, by inputting the scores of the row 0 and column 0 with –j*d and –
i*d respectively .This has a time complexity of O(M+N).
Step 2: Fill in the matrix with all the scores, F(i,j). For each cell of the matrix, three
neighboring cells must be compared, which is a constant time operation. Thus, to fill the entire
matrix, the time complexity is the number of entries, or O(MN).
Step3 the trace back requires a number of steps.
a)Mark the cells according to the rules above. Then move a maximum of N rows and
M columns, and thus the complexity of this is O(M+N).
b) Find the final path which involves jumping from cells of matching residues. Since this
step can include a maximum of N cells (where we assume N>M),
this step is O(N).
Thus, the overall time complexity of this algorithm is:-
O(M+N)+O(MN)+O(M+N)+O(N)=O(MN)
Since this algorithm fills a single matrix of size MN and stores at most N positions for the trace
back, the total space complexity of this algorithm is:-
O(MN)+O(N)=O(MN).
2. Top down String Alignment Algorithm
An example of top down algorithm is the Longest Common Subsequence (LCS) i.e.
Value (n,M)
{
if (n == 0) return 0;
if (arr[n][M] != unknown) return arr[n][M]; // <- added this
if (m_n > M) result = Value(n-1,M);
else result = max{v_n + Value(n-1, M-m_n), Value(n-1, M)};
arr[n][M] = result; // <- and this
return result;
}
3 .What is the time complexity of the algoritm ?
Run time complexity is = O (nM).
According to Avrim Blum of Department of Computer Science Carnegie Mellon University
Comparing bottom-up and top-down string alignment algorithms , both do almost the same
work. The Top-down (memorized) version pays a penalty in recursion overhead, but can
potentially be faster than the bottom-up version in situations where some of the sub problems
never get examined at all. These differences, however, are minor one should use whichever
version is easiest and most intuitive for you for the given problem at hand.
REFERENCES
1. Lecture Notes Department of Computer Science Carnegie Mellon University September 29,
2009 Avrim Blum
2. Needleman S, Wunsch C. A general method applicable to the search for similarities in the
amino acid sequence of two proteins. J Mol Biol 1970;48:443–453.
3. An Efficient Algorithm for Multiple Sequence Alignment Kuen-Feng Huang, Chang-Biau
Yang and Kuo-Tsung Tseng Department of Computer Science and Engineering National Sun
Yat-Sen University.
4. Top-Down vs. Bottom-Up Revisited Raghu Ramakrishna and S. Sudarshan University of
Wisconsin-Madison Madison, WI 53706, USA fraghu,[email protected]