Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
cse373hw5

cse373hw5

Ratings: (0)|Views: 150|Likes:
Published by Chao Xu

More info:

Published by: Chao Xu on May 06, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/24/2012

pdf

text

original

 
CSE 373 Spring 2010 HW #5
Chao Xu(106978083), Xiaodi Zheng(106718764)
 
1
The best alignment between the string pairs “watch the movie raising Arizona?” and “watch the mets razeArizona?” is MMMMMMDSSMMDSSSMMMDDDSSMMMMMMMMM, with a matching cost of 12.The best alignment between the string pairs “this is what happens when I type slow” and “htishisth whatyhavpens when ui type fasht is SSMMSSMMIIMMMMMIMMMSMMMMMMMMMMISMMMMMMISSSSM,with a matching cost of 14.The best alignment between the string pairs “leonard skiena” and “lynard skynard” is MDSMMMMM-MMDSMMIIM, with a matching cost of 6.1
 
2
8-3
(a) Let
[
i,j
] denote the length of the matching substring that ends at the
i
th element of 
and the jthelement of 
. then the recurrence function is defined as:
[
i,j
] =
[
i
1
,j
1] + 1 if 
[
i
] ==
[
i
]
[
i,j
] = 0 if 
[
i
]! =
[
i
]Build the matrix in
O
(
mn
) time. Search though the matrix for the largest value
k
in
O
(
mn
) time. If it’s at (
i,j
) of the matrix, output
[
i
k
] to
[
i
].(b) For every element in
search in
for th longest substring that ends or starts from that element.
8-7
(a) 7 ways, 2(10),1(10)+1(6)+4(1),1(10)+10(1),3(6)+2(1),2(6)+8(1),1(6)+14(1),20(1)(b)
(
n,d
) =
(
n,d
1) if 
d
∈ {
d
1
,...,d
k
}
(
n,d
) =
(
n,d
1) +
(
n
d,d
) if 
d
{
d
1
,...,d
k
}
(
n,
0) = 0It take
O
(
nd
k
) time, as for each
(
n,d
),it can be calculated in
O
(1) time.2

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->