Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

-

3/27/2012


/

PDF


English
Esperanto
Franais
Italiano

.
)(
) (Longest Common Subsequence :
) (
.
.
][


. LCS


][

Polski

.
. .

.

.

][

LCS ) (Optimal Substructure:


LCS .

. :
:


LCS Y X . :

LCS

Z LCS

Z LCS

LCS : LCS .

LCS

][

C LCS

LCS .

. i=0 j=0


LCS
LCS

. :

http://fa.wikipedia.org/wiki/%D8%A8%D8%B2%D8%B1%DA%AF%E2%80%8C%D8%AA%D8%B1%DB%8C%D9%86_%D8%B2%DB%8C%D8%B1%D8%AF%D9%86%D8%A8%D8%A7%D9%84%D9%87_%D
1/3

3/27/2012

LCS

.
LCS
) .(
. row-major . c


.
. .

)

.
b
.( LCS .
LCS b .

)function print_LCS (b,X,i,j


if i=0 or j=0 then

http://fa.wikipedia.org/wiki/%D8%A8%D8%B2%D8%B1%DA%AF%E2%80%8C%D8%AA%D8%B1%DB%8C%D9%86_%D8%B2%DB%8C%D8%B1%D8%AF%D9%86%D8%A8%D8%A7%D9%84%D9%87_%D
2/3

3/27/2012

return
' = ]if b[i,j

' then
)print_LCS(b,X,i-1,j-1
print
else if b[i,j]= ' ' then
)print_LCS(b,X,i,j-1
)else print_LCS(b,X,i,j-1

][

.
. LCS
N
.
. :
n m

[]

][

.L. Bergroth and H. Hakonen and T. Raita. SPIRE (IEEE Computer Society) 00 (2000): 3948 .1

][

Longest common subsequence problem )


.(
. . :
.
Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein. . In Introduction to Algorithms.
.second ed. MIT Press and McGraw-Hill, 2001. 350355. ISBN 0-262-53196-8
:

: .
Creative Commons Attribution/Share-Alike .
.

http://fa.wikipedia.org/wiki/%D8%A8%D8%B2%D8%B1%DA%AF%E2%80%8C%D8%AA%D8%B1%DB%8C%D9%86_%D8%B2%DB%8C%D8%B1%D8%AF%D9%86%D8%A8%D8%A7%D9%84%D9%87_%D
3/3

You might also like