You are on page 1of 757

##################>###

################################################

`!#U####i
x
ZI,#j:###########
#####D##;#######xcdd``ed``ba##V
d##,FYz#P1n:###8,56~#)

#@# ##'#-j##UX#RY`#7S?##&meab##M-VK-W#Mc#\<
#

#X.###8@2>0~#+#a#s|7##
#~#g##
##L@(#\P##dz_#s#Nb#?#C##\
q##;##wLLJU% #H##X##,##Z`!#####` ##/#p########### ##
###

2#<?######x Mh#A#f$icGa:H)-

EV#Rl1Vhx#x#####Z<x##"Rz## <E#3a(#vw~
###@#p#L#bfZ-=+YKX]/2r6##h)1%-yx##>FS
2OwiS[#YWTyUL/WJs##<H`:#~e##\)##?uc#B!
iu#W#3#[G#;u\R*p>dJ-q#_sN+@#Ku##
##j  X/X>#=~]#7c_TWFYp#^U+ ,#`p##q,#WQu2eS#
##7yp7
xs#q#w#q~y#u##/)|=H#]  E uv#pP)
###?:@:m  r ]
n >E^.?#'-N`}cC_)#X?
a`\X/##Rh?g#p~#5
'o;w##_X/_cr!
##qR<uIS#G>#{1Bzn1OF##5 }'###rl]44=_XBbmZ(R^##
z?#>*`!#####TW]#F#E#NZ##############@###j##|
##^####xcdd``^ ##@#c112BYL##%bpu<L#L#,56~#)

#@# k##730<##UX#RY##7  ##&meab##M-VK-W#Mc#\<


#

#X.##0~#dWBkGy`##G #0SVT#&T###P#ZQR##5
`c #HE(G,#>#{?#\#NNP#F|1#_z#?

#b? ##Ma(w#
q!6#WSm%#4#rS*D#.##v0o#8m321)#W#x ],

0O`q#hy`!#p###a#k%#6HG###########
##`######+##>####xcdd``ed``ba##V
d##,FYz#P1n:###B@##?#  b##
#####sC0&dT#20###
K#X##B2sS#R#s###=^~###*g`0``###F\ <P!#'0#W#RS
#1##w('#`#=##0#1 7+ka/##7#dB^%z2R# #*
 # 2#8%##"###{iI)$5#bPd(#/#v#<^Gf,#t#################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
#######i#####(###################
#####################
######
#############################################g#######Y##############E#q#u#a
#t#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t#
#E#q#u#a#t#i#o#n#
#3#.#0#####################################h#######[##############E#q#u#a#t
#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t# #E#q#u#a#t#i#o#n#
#3#.#0#####################################i#######_##############E#q#u#a#t
#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t# #E#q#u#a#t#i#o#n#
#3#.#0#####################################j#######f##############E#q#u#a#t
#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t# #E#q#u#a#t#i#o#n#
#3#.#0####L###/##

###0#############|
######D###A#r#i#a#l#####g#s########}#(#######0########(##z[ 0
#########D###G#a#r#a#m#o#n#d##########}#(#######0########(##z[
0
###### ##D###T#i#m#e#s# #N#e#w# #R#o#m#a#n###(#######0########(##z[
0
######0##D###W#i#n#g#d#i#n#g#s###R#o#m#a#n###(#######0########(##z[
0
######@##D###S#i#m#S#u#n###g#s###R#o#m#a#n###(#######0########(##z[
0
########
####`##############0#.################
#########
###@##n#####?###"
##d######d#########@########################## #
#########@#@#########`#`####################################|
###############################################################################
######################################################

###

######
#######################################################
###############################################################
#######
##############################################################################
###############################################################

#######################################

###############################y###############w###############e###############
#######
###@#######A#######B#######C#######D#######E######################H#######I####
###J#######K#######L#######M#######N#######O#######P#######Q#######R#######S####
###T#######U#######V############################################################
#######################
#####################################################m###############
###############################
################################################################################
#######
#######

#######################################################################
###############################################
#######
#######################################################
###############
###########################################################################?
#########$#########################################$#######################
##################$#########################################$################
#########################$#########################################$########
#################################$#########################################$
#########################################$###################################
######$#########################################$###########################
##############$#########################################$####################
#####################$#########################################$############
#############################$#########################################$####
#####################################$#######################################
##$#########################################$###############################
##########$#########################################$#######################
##################$#########################################$################
#########################$#########################################$########
#################################$#########################################$
#########################################$###################################
######$#########################################$###########################
###########2##$######i
x
ZI,#j#]###############2##$#####`
##/#p#########]#######2##$######TW]#F#E#N########k#######2##$###
##a#k
%#6HG#x#################0#############A##############A##########
#####0##

#########33#@########################8##########
###############################################c####################;#
#;#######g################4###A###d###A###d###########@##z[
0########^####p##########p###p##########@##############

###################<######4###d###d###d###d#######l##<
0##########################<######4###B###d###B###d#######l##<
0########################$#################_#_#_#P#P#T#1#0############
####D###S#i#m#S#u#n###e#w# ###############0##########z[
0########D###A#r#i#a#l#####e#w# ###############0##########z[
0###### ##D###T#i#m#e#s# #N#e#w# #R#o#m#a#n#########0##########z[
0###################?##

###########%#####V#########V###########.#########################Longest
Common Subsequence### ###################`##############################
############################Definition: The longest common subsequence
or LCS of two strings S1 and S2 is the longest subsequence common between two
strings.
###########################

################################################################################
#####################7#############`##########################################
#######
##################W###########/#########################LCS
Theorem### ###

###############`##############################
############################T#h#e# #L#C#S# # #c#a#n# #b#e# #f#o#u#n#d#
#b#y# #d#y#n#a#m#i#c# #p#r#o#g#r#a#m#m#i#n#g# #f#o#r#m#u#l#a#t#i#o#n#.# #O#n#e#
#c#a#n# #e#a#s#i#l#y# #s#h#o#w#:##T#h#e#o#r#e#m#:# #W#i#t#h# #a# #s#c#o#r#e#
#o#f# #1# #f#o#r# #e#a#c#h# #m#a#t#c#h# #a#n#d# #a# #z#e#r#o# #f#o#r# #e#a#c#h#
#m#i#s#m#a#t#c#h# #o#r# #s#p#a#c#e# #,# #t#h#e# #m#a#t#c#h#e#d#
#c#h#a#r#a#c#t#e#r#s# #i#n# #a#n# #a#l#i#g#n#m#e#n#t# #o#f# #m#a#x#i#m#u#m#
#v#a#l#u#e# #f#o#r# #a# #L#C#S#.##S#i#n#c#e# #i#t# #i#s# #u#s#i#n#g# #t#h#e#
#g#e#n#e#r#a#l# #d#y#n#a#m#i#c# #p#r#o#g#r#a#m#m#i#n#g# #a#l#g#o#r#i#t#h#m#
#i#t#s# #c#o#m#p#l#e#x#i#t#y# #i#s# #O#(#n#m#)# #.##A# #l#o#n#g#e#s#t#
#s#u#b#s#t#r#i#n#g# #p#r#o#b#l#e#m#,# #o#n# #t#h#e# #o#t#h#e#r# #h#a#n#d#
#h#a#s# #a# #O#(#n#+#m#)# #s#o#l#u#t#i#o#n#.# #S#u#b#s#e#q#u#e#n#c#e#s# #a#r#e#
#m#u#c#h# #m#o#r#e# #c#o#m#p#l#e#x# #t#h#a#n# #s#u#b#s#t#r#i#n#g#s#.# ##C#a#n#
#w#e# #d#o# #b#e#t#t#e#r# #f#o#r# #t#h#e# #L#C#S# #p#r#o#b#l#e#m#?# #W#e#
#w#i#l#l# #s#e#e# #&
####"###O#########Z##########Z###########Z#######################F############
#########
######################################b#########M##############################
##############

b##

##################4#######################>#################b#########1#########
########b############## ### #####|##################
###N#################################
###7#################@###############
###1###############
##################X###########0###################################The
optimal alignment is shown above. Note the alignment shows three insert (dark),
one delete green) and three substitution or replacement operations (blue), which
gives an edit distance of 7. But, the 3 replacement operations can be realized
by 3 insert and 3 delete operations because a replacement is equivalent to first
delete the character and then insert a character in its place
like:###n############Z#_###############b#####################332############
####

b##

##############################################################################b
#########
#################f################## ### ####### ### ########### ###
#######$f##$###############$b##$###########(###(###########(###(#######,f##,####
###########,b##,###########0###0######}####0###0########_###############
###7###############
###+###############
###
###############
###+###############
###################
#################Z###########1####################################if
we give a cost of 2 for replace operation and cost of 1 for both insert and
delete operations, the minimum edit distance D can be computed in terms of the
length L of LCS as:
For the above example, n=10, m=12,
L=6. So, D=10 ( 6 insert and 4 delete).
############################L###############################"#################
######################'#################(###################################
################################################################################
##########################################\###########2#####################1
###Direct Computation of LCS by Dynamic
Programming######2###############b#####&###########&#######b#######&######

###

&######

###

&######

###

&#######b#######&###########&#######b#######&###########&####P###########
###################
###################
###################
############################More efficient although the asymptotic
complexity remains the same, O(nm). Let L denote The equations are given below
without proof (which is simple).Again, if we leave suitable back pointers in the
matrix, trace(s) can be derived for the
LCS.###############Z#######b#######C#########################################
####################################################b##############

###

##

####

###

##>####

###

########b###############b#########Y######################################`#####
######
###C#################################
###K###############
###9################################]###########3#####################`###E#x
#a#m#p#l#e# #3#:# #E#d#i#t# #D#i#s#t#a#n#c#e# ###
#
#
#=# #6# #+# #8#
## #2#*#5# # #=# #4# ####L###1#########
#######&#######b#######&###########&######

b##

####&###########&####0###
###############
###################
##################^###########4#########################A Faster
Algorithm for LCS###################################################P###A#n#
#a#l#g#o#r#i#t#h#m# #t#h#a#t# #i#s# #a#s#y#m#p#t#o#t#i#c#a#l#l#y# #b#e#t#t#e#r#
#t#h#a#n# #O#(#n#m#)# # #f#o#r# #d#e#t#e#r#m#i#n#i#n#g# #L#C#S#.# #
#I#m#p#l#i#e#s# #t#h#a#t# #f#o#r# #s#p#e#c#i#a#l# #c#a#s#e#s# #o#f# #e#d#i#t#
#d#i#s#t#a#n#c#e#,# #t#h#e#r#e# #e#x#i#s#t# #m#o#r#e# #e#f#f#i#c#i#e#n#t#
#a#l#g#o#r#i#t#h#m#.##D#e#f#i#n#i#t#i#o#n#:# ##L#e#t# ## #b#e# #a# #s#e#t#
#o#f# #n# #i#n#t#e#g#e#r#s#,# #n#o#t# #n#e#c#e#s#s#a#r#i#l#y#
#d#i#s#t#i#n#c#t#.##D#e#f#i#n#i#t#i#o#n#:# ##A#n# #i#n#c#r#e#a#s#i#n#g#
#s#u#b#s#e#q#u#e#n#c#e#(#I#S#)# #o#f# ## #i#s# #a# #s#u#b#s#e#q#u#e#n#c#e#
#o#f# ## #w#h#o#s#e# #v#a#l#u#e#s# #a#r#e# #s#t#r#i#c#t#l#y#
#i#n#c#r#e#a#s#i#n#g# #f#r#o#m# #l#e#f#t# #t#o# #r#i#g#h#t#.##E#x#a#m#p#l#e#:#
##=#(#5#,#3#,#4#,#4#,# #9#,#6#,#2#,#1#,#8#,#7#,#1#0#)#.# #
#I#S#=#(#3#,#4#,#6#,#8#,#1#0#)#,#
#(#5#,#9#,#1#0#)################Z#8#########Z#
#########Z#r#########Z#A#########Z#######b#######/##############################
###########################################################b#########.####

###

########b#########&#################b#########

################ b## ###########$###$#######$###$##%####$###$##

####$###$#######(b##(###########,###,#######,###,#######,###,###########,###,###
####,###,#######,###,##)####,###,#######,###,###########,###,#######,###,##'####
0###0#######0###0#######0###0################
###/#################################
###.###############
###&###############
###

###############

###D###############

###################################`###########5############################
#######D#e#f#i#n#i#t#i#o#n#:# ##A# #l#o#n#g#e#s#t# #i#n#c#r#e#a#s#i#n#g#
#s#u#b#s#e#q#u#e#n#c#e#(#L#I#S#)# #o#f# ## #i#s# #a#n# #I#S# ## #o#f#
#m#a#x#i#m#u#m# #l#e#n#g#t#h#.##D#e#f#i#n#i#t#i#o#n#:# ##A#
#d#e#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e# #(#D#S#)# #o#f# ## #i#s# #a#
#n#o#n#-#i#n#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e# #f# ##.##E#x#a#m#p#l#e#:#
#D#S#=#(#5#,#4#,#4#,#2#,#1#)#.#################I#########
#########H###################

#############`##################################################################
#########################

##############

`##

##################################`#######*#########
################################V###

###############

#####################1###############

###################

###C##############a###########6################################f###D#e#f#i#n
#i#t#i#o#n#:# ##A# #c#o#v#e#r# #i#s# #a# #s#e#t# #o#f# #d#i#s#j#o#i#n#t# #D#S#
#o#f# ## #t#h#a#t# #c#o#v#e#r#s# #o#r# #c#o#n#t#a#i#n#s# #a#l#l#
#e#l#e#m#e#n#t#s# #o#f# ##.# #T#h#e# #s#i#z#e# #o#f# #t#h#e# #c#o#v#e#r# #c#
#e#q#u#a#l#s# #t#h#e# #n#u#m#b#e#r# #o#f# #D#S# #i#n# #t#h#e# #c#o#v#e#r#.#
#E#x#a#m#p#l#e#:# ##=#(#5#,#3#,#4#,#9#,#6#,#2#,#1#,#8#,#7#)# #C#o#v#e#r#:#{#
#(#5#,#3#,#2#,#1#)#,#(#4#)#,#(#9#,#6#)#,#(#8#,#7#)#}#.# #C#=###o#f# #D#S#=#4#.#
#D#e#f#i#n#i#t#i#o#n#:# ##A# #s#m#a#l#l#e#s#t# #c#o#v#e#r# #(#S#C#)# #i#s# #a#
#c#o#v#e#r# #w#i#t#h# #a# #m#i#n#i#m#u#m# #v#a#l#u#e# #o#f# #c#.#####F###
##################\#########<###################

#############`###################################################F##############
###################################C############################################
##########

`##

######################################################################$#########
#######################0###

###############
##################
###=##############b###########7#####################/###Determine LIS
and SC simultaneously in O(nlogn)######0###############b#####&#
#########&###########&###########&###########&###########&###########&#######b##
#####&######

###

&######

###

&######

###

&######

###

&####2###########
###"###############
#######################################L#e#m#m#a#:# ##I#f# #I# #i#s#
#a#n# #I#S# #o#f# ## #w#i#t#h# #l#e#n#g#t#h# #e#q#u#a#l# #t#o# #t#h#e#
#s#i#z#e# #o#f# #a# #c#o#v#e#r# #C# #o#f# ##,# #t#h#e#n# #I# #i#s# #a# #L#I#S#
#o#f# ## #a#n#d# #C# #i#s# #t#h#e# #s#m#a#l#l#e#s#t# #c#o#v#e#r# #o#f#
#s#i#z#e# #c#.# #
##############################################################`##############
#################################<##################################

`##

########################
##############################################################0################
###
###M###############
###4##############c###########8#########################Proof##############
T###I#f# #I# #i#s# #a#n# #i#n#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#,# #i#t#
#c#a#n#n#o#t# #c#o#n#t#a#i#n# #m#o#r#e# #t#h#a#n# #o#n#e# #e#l#e#m#e#n#t#
#f#r#o#m# #a# #d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#.# ##T#h#i#s# #m#e#a#n#s#
#t#h#a#t# #n#o# #i#n#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e# #c#a#n# #h#a#v#e#
#s#i#z#e# #m#o#r#e# #t#h#a#n# #t#h#e# #s#i#z#e# #o#f# #a#n#y# #c#o#v#e#r# #C#,#
#t#h#a#t# #i#s#,# #i#f# ## # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # ## # # # # #a# #m#a#x#i#m#u#m# #o#f# #o#n#e#
#e#l#e#m#e#n#t# #f#r#o#m# #e#a#c#h# #c#a#n# #p#a#r#t#i#c#i#p#a#t#e# #i#n#
#a#n#y# #i#n#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#.# ##T#h#u#s#,# #a#n# #I#S#
#d#e#r#i#v#e#d# #f#r#o#m# #t#h#i#s# #d#e#c#o#m#p#o#s#i#t#i#o#n# #c#a#n#
#h#a#v#e# #a# #m#a#x#i#m#u#m# #l#e#n#g#t#h# #o#f# #|#C# #|#=#c#.#
#C#o#n#v#e#r#s#e#l#y#,# #C# #m#u#s#t# #b#e# #t#h#e# #s#m#a#l#l#e#s#t#.# #I#f#
#n#o#t#,# #l#e#t# #c## #b#e# #t#h#e# #l#e#n#g#t#h# #o#f# #a# #c#o#v#e#r# #C##
#s#u#c#h# #t#h#a#t# #|#C## |#=#<# #c# # #i#.#e#.#,# #i#f# #w#e# #d#e#r#i#v#e#
#I#S# #f#r#o#m# #C#,# #i#t# #m#u#s#t# #c#o#n#t#a#i#n# #m#o#r#e# #t#h#a#n#
#o#n#e# #e#l#e#m#e#n#t# #f#r#o#m# #o#n#e# #o#f# #t#h#e# #d#e#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e# #o#f# #C## ,# #w#h#i#c#h# #i#s# #n#o#t# #p#o#s#s#i#b#l#e#.# #
#H#e#n#c#e# #C# #h#a#s# #t#o# #b#e# #o#f# #s#m#a#l#l#e#s#t# #s#i#z#e#.#
####6############Z#~###########Z#`#########Z#######################_##########
#####b#########X#######################################

b##

######)#################b#########O#################b#########
#### ###
####### ### ##>#### ### ####### ### ####### ### ####### ### ####### ### #######
### ##"#### ###
#######$b##$###########$b##$###########(###(#######(###(#######(###(#######(###(
#######(###(#######(###(#######(###(#######,b##,######
####0###0#######0###0#######0###0#######0###0##M####0###0#######0###0#######0###
0#######0###0#######0###0#######0###0#######0###0########d###############
###f###############
###)###############
###O###############
##################
###/###############
#################d###########9#########################Construction of
a cover#################G#r#e#e#d#y# #a#l#g#o#r#i#t#h#m# #t#o# #d#e#r#i#v#e#
#a# #c#o#v#e#r#:##S#t#a#r#t#i#n#g# #f#r#o#m# #t#h#e# #l#e#f#t# #o#f# ##,#
#e#x#a#m#i#n#e# #e#a#c#h# #s#u#c#c#e#s#s#i#v#e# #n#u#m#b#e#r# #i#n# ##.# #
#A#p#p#e#n#d# #t#h#e# #c#u#r#r#e#n#t# #n#u#m#b#e#r# #a#t# #t#h#e# #l#e#f#t##m#o#s#t# #s#u#b#s#e#q#u#e#n#c#e# #d#e#r#i#v#e#d# #s#o# #f#a#r# #i#f# #i#t#
#i#s# #p#o#s#s#i#b#l#e# #d#o# #t#h#a#t# #m#a#i#n#t#a#i#n#i#n#g# #t#h#e#
#d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e# #p#r#o#p#e#r#t#y#.# ##I#f# #n#o#t#
#s#t#a#r#t# #a# #n#e#w# #d#e#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e#
#b#e#g#i#n#n#i#n#g# #w#i#t#h# #t#h#e# #c#u#r#r#e#n#t# #e#l#e#m#e#n#t#.# #
#P#r#o#c#e#e#d# #u#n#t#i#l# ## #i#s# #e#x#h#a#u#s#t#e#d#.#######$#########?
###############`#################################`############

###

B###############`######################`#######N#### ###
#####$`##$#########(###(###d########### ###################
###S###############
##################
###N###############
##################e###########:#########################Example#############
#0####=#(#5#,#3#,#4#,#9#,#6#,#2#,#1#,#8#,#7#,#1#0#)#
#D#1#=#(#5#,#3#,#2#,#1#)#,# #D#2#=#(#4#)#,# #D#3#=#(#9#,#6#)#,#
#D#4#=#(#8#,#7#)#,# #D#4#=#(#1#0#)##T#h#e# #a#l#g#o#r#i#t#h#m# #h#a#s# #O#
#(#n#2#)# #c#o#m#p#l#e#x#i#t#y#.# #W#e# #w#i#l#l# #p#r#e#s#e#n#t# #a#n# #O#
#(#n# #l#o#g#n#)# #a#l#g#o#r#i#t#h#m#.##################################

################################################################################
###############################################L#########################
###############################################################

###############################
##############g###########;#####################1###An Efficient Algorithm
for Constructing the Cover#######2#########2#######&###############@###W#e#
#u#s#e# #a# #d#a#t#a# #s#t#r#u#c#t#u#r#e# #w#h#i#c#h# #i#s# #a# #l#i#s#t#
#c#o#n#t#a#i#n#i#n#g# #t#h#e# #l#a#s#t# #n#u#m#b#e#r# #o#f# #e#a#c#h# #o#f#
#t#h#e# #d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e# #t#h#a#t# #i#s# #b#e#i#n#g#
#c#o#n#s#t#r#u#c#t#e#d#.# ##T#h#e# #l#i#s#t# #i#s# #a#l#w#a#y#s# #s#o#r#t#e#d#
#i#n# #i#n#c#r#e#a#s#i#n#g# #o#r#d#e#r#.# #A#n# #i#d#e#n#t#i#f#i#e#r#
#i#n#d#i#c#a#t#i#n#g# #w#h#i#c#h# #l#i#s#t# #t#h#e# #n#u#m#b#e#r#
#b#e#l#o#n#g#s# #t#o# #a#l#s#o# #i#n#c#l#u#d#e#d#.##P#r#o#c#e#d#u#r#e#
#D#e#c#r#e#a#s#i#n#g# #S#e#q#u#e#n#c#e# #C#o#v#e#r##I#n#p#u#t#:# ##=# # # # # #
# # # # # # # # # # # # # # # # # # # #,# #t#h#e# #l#i#s#t# #o#f# #i#n#p#u#t#
#n#u#m#b#e#r#s#.##O#u#t#p#u#t#:# #t#h#e# #s#e#t# #o#f# #d#e#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e#s# #D#i# # #c#o#n#s#t#i#t#u#t#i#n#g# #t#h#e#
#c#o#v#e#r#.###############################b#########D################

b##

######^#################b###########################b#########C#### ### #######


### ####### ### ####### ### ####### ### #####j##################
###D###############
###^###############
###################
###C################################h###########<#########################O(n
logn) Algorithm###F#################################################
#####`####################8#######################################
#######
#########################4###I#n#i#t#i#a#l#i#z#e#:# # #i#!1#;# #
#D#i#=#(#x#1#)#;# # #L#=#(#x#1#,# #i#)# #;# #j#!1#;##F#o#r# #i#=#2# #t#o# #n#
#d#o##S#e#a#r#c#h# #t#h#e# #x#-#f#i#e#l#d#s# #o#f# #L# #t#o# #f#i#n#d# #t#h#e#
#f#i#r#s#t# #x#-#v#a#l#u#e# #s#u#c#h# #t#h#a#t# ## # # # #x#i# #<# #x#.# # #
#& .#t#a#k#e#s# #O#(# #l#o#g#n#)# #t#i#m#e#.##I#f# #s#u#c#h# #a# #v#a#l#u#e#
#e#x#i#s#t#s#,# #t#h#e#n# #i#n#s#e#r#t# #x# #a#t# #t#h#e# #e#n#d# #i#n# #t#h#e#
#l#i#s#t# #D#i# #a#n#d# #s#e#t# #x#i#!x# #i#n# #L#& #T#h#i#s# #s#t#e#p#
#t#a#k#e#s# #c#o#n#s#t#a#n#t# # # #t#i#m#e#.##I#f# #s#u#c#h# #a# #v#a#l#u#e#
#d#o#e#s# #n#o#t# #e#x#i#s#t# #i#n# #L#,# #t#h#e#n# #s#e#t# #j#!j#+#1#.#
#i#n#s#e#r#t# #i#n# #L# #a# #n#e#w# # #e#l#e#m#e#n#t# #(#x#,#j#)# #a#n#d# #
#s#t#a#r#t# #a# #n#e#w# #d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e# #D#j#=#(#x#)#
#E#n#d####P###>#########P#>#########P#%###########P##########P#############P#
################################################################################
################################################################################
################################################################################
###########################
#############################b###############b##############

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

##,####

###

#######

###

#######

###

#######

###

##

####

###

#######

###

#######

###

#######

###

#######

###

#######

###

##

####

###

#######

###

#######

###

##

####

###

##*####

###

#######

###

#######

###

#######

###

#######

###

#######

###

######

###

#######

###

#######

###

#######

###

##'####

###

#######

###

#######

###

#######

###

#######

###

########b#############################################f###############
#####################E#################
#################y#################'#################################
##################i###########=###################################Lemma: At
any point in the execution of the algorithm the list L is sorted in increasing
order with respect to x-values as well as with respect to identifier value.In
fact two separate lists will be better from practical implementation point of
view.Theorem: The greedy cover can be constructed taking O(nlogn) time. A
longest increasing sequence and a smallest cover thus can be constructed using
O(nlogn)
time.###>######################a##################################b#########8
#######################/#######################5###########`################

b##

######+#########################################################################
##X#############################################################################
#############T################### ##################
###+#################Y################################j###########>###########
##########D###E#x#a#m#p#l#e#:# #
##=#(#5#,#3#,#4#,#9#,#6#,#2#,#1#,#8#,#7#,#1#0#)###############
####################k###########?#####################'###Reduction of LIS
problem to LCS problem###@###(#########
#######&###########&#########&###########&#########&###################Definit
ion: Given sequences S1 and S2, let ri be the number of occurrence of the ith
character of S1 in S2.
(position index in sequence S2: ) 1
2 3 4 5 6 Example:S1=a b a c x and S2= b a a b c a Then, r(1)=3, r(2)=2,
r(3)=3, r(4)=1, r(5)=0 .###############a####################

#############`##################################################################
#$#####################################################################
####

`##

##############
#####`#####################################b############## ###
####### ### #####$`##$#########(###(#####(###(#####(###(
####(###(#####(###(#####(###(#####(###(
####(###(#####(###(#####(###(#####(###(#####(###(#####(###(#####(###(#####(###(#
####(###(#####(###(#####(###(#####(###(######

###############
#####################%######################### #######
########### #######
###################
###################
###f##############l###########@###################################D#e#f#i#n
#i#t#i#o#n#:# ##f#o#r# #e#a#c#h# #d#i#s#t#i#n#c#t# #c#h#a#r#a#c#t#e#r# #x# #i#n#
#S#1#,# #d#e#f#i#n#e# #l#i#s#t#(#x#)# #t#o# #b#e# #t#h#e# #p#o#s#i#t#i#o#n#s#
#o#f# #x# #i#n# #S#2# #i#n# #d#e#c#r#e#a#s#i#n#g# #o#r#d#e#r#.##
#E#x#a#m#p#l#e#:# # # #l#i#s#t#(#a#)#=# #(#6#,#3#,#2#)#;# # #
#l#i#s#t#(#b#)#=#(#4#,#1#)#,# # # #l#i#s#t#(#c#)#=#(#5#)#,# #l#i#s#t#(#x#)#=##
#(#e#m#p#t#y# #s#e#q#u#e#n#c#e#)#.####x############h#########Z#########

#############`##################################################################
######################################################################

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

###v###

###############
###,#################B##########################################################
############################m###########A################################|
###D#e#f#i#n#i#t#i#o#n#:# #L#e#t# ## #(#S#1#,#S#2#)# #b#e# #a#
#s#e#q#u#e#n#c#e# #o#b#t#a#i#n#e#d# #b#y# #c#o#n#c#a#t#e#n#a#t#i#n#g#
#l#i#s#t#(#s#i#)# #f#o#r# #i#=#1#,#2#,#& ,#n# #w#h#e#r#e# #n# #i#s# #t#h#e#
#l#e#n#g#t#h# #o#f# #S#1# #a#n#d# #s#i# #i#s# #t#h#e# #i#t#h# #s#y#m#b#o#l#
#o#f# #S#1#.# ##E#x#a#m#p#l#e#:# ## #(#S#1#,#S#2#)#=#
#(#6#,#3#,#2#,#4#,#1#,#6#,#3#,#2#,#5#)#.##################################*##
################################################################################
#######################################################################

##############################################>###B#################0##########
#########################9##############n###########B########################
###########T#h#e#o#r#e#m#:# ##E#v#e#r#y# #i#n#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e# #I# #o#f# ## #(#S#1#,#S#2#)# #s#p#e#c#i#f#i#e#s# #a#n#
#e#q#u#a#l# #l#e#n#g#t#h# #c#o#m#m#o#n# #s#u#b#s#e#q#u#e#n#c#e# #o#f# # #S#1#
#a#n#d# #S#2# #a#n#d# #v#i#c#e# #v#e#r#s#a#.# #T#h#u#s# #a# #l#o#n#g#e#s#t#
#c#o#m#m#o#n# #s#u#b#s#e#q#u#e#n#c#e# #L#C#S# # #o#f# #S#1# #a#n#d# #S#2#
#c#o#r#r#e#s#p#o#n#d#s# #t#o# #a# #l#o#n#g#e#s#t# #i#n#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e# #o#f# ## #(#S#1#,#S#2#)#.##E#x#a#m#p#l#e#:# ##
#(#S#1#,#S#2#)#=# #(#6#,#3#,#2#,#4#,#1#,#6#,#3#,#2#,#5#)#.# #T#h#e#
#p#o#s#s#i#b#l#e# #l#o#n#g#e#s#t# #i#n#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#s#
#u#s#e#d# #a#s# #i#n#d#i#c#e#s# #t#o# #a#c#c#e#s#s# #t#h#e#
#c#h#a#r#a#c#t#e#r#s# #i#n# #S#2# #y#i#e#l#d# #t#h#e# #L#C#S# #a#s#:#
#(#1#,#2#,#5#)#=# #b# #a# #c#,# # # #(#2#,#3#,#5#)#=#a# #a# #c#,# #
#(#3#,#4#,#6#)#=# #a# #b# #a# #f#o#r# #S#1#=#a# #b# #a# #c# #x# #a#n#d# #S#2#=#
#b# #a# #a# #b# #c# #a#.####T###
###########################
###############b#########################################################3######
#########################################4######################################
#################################5###################################

####

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

##Y####

###

#######

###

#######

###

#######

###

######

###

#######

###

##

####

###

#######

###

##

####

###

#######

###

#######

###

#######

###

#######

###

##
####

###

#######

###

#######

###

#######

###

######

###

######### ###############
#####################################
################`## #######333####3###ff3#`##
########333##3f#33##ff3#`## ###"####333##3###
###ff3#`##
#########K##f##3###
###`## ####&###e###
3#g#3f####`##
####f##333###
######po7#`## ########___##f3##
##;/#f##9#`##
########ff#####3#Lm##`##
########ff##3###LmN#Lm#####>#####?###"
##d#######d#########@################*###############?
###n###A#######d########@###########################q#<#############
###n#A################q#F#####L############K#######M##### ##n#####?###"
##d######d#########@################

########### #
#########@#@#########`#`###############P##R########################
##############
##############
##############
######M#####`##################2#p##>#########################################
##########################>###################################################
################

# #####################@###########(##### ######################
#####@##############
#####@###
####H###  #######`9######?###################################?
#####  #######"############### #`#}#####################9###
X################# ###Click to edit Master title style#######!############!
#########
#
####@#####
#####@###
####H###  ######b9######?###################################?
#####  #######"############### #`#######################9###
#################R###Click to edit Master text stylesSecond levelThird level
Fourth levelFifth level#######!##########

##########

############S######### #
##########
#####@###
####6###  ######,i9#############################

#########"

######`#############]# #`#}#####################9###
t#####################*####(###################c#######

#############

############################### #########
#
#########
#####@###
####6###  ###### o9#############################
#########"

######`#############`###################### #9###
V#####################*##############################

###############

########### #
#########
#####@###
####6###  ######(t9#############################

#########"

######`#############]# #`#}#####################9###
V#####################*##############################

###############

########### #
#########
#####@###
##C#####  #####@#####A#####B####C####D#####E

###F####  ##########################jJ###############################
######################@#####3#"############################0######
`###B#
#####@###
##s##*###D#####  ################jJ###############"################0#
#`#0####H#####
#####@###

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.#####
###+##########D=#####' ################################=###@#B#####
######+#### ######E#d#g#e#####################
#################

######################D###########(##### ######################
#####D##############
#####D###
####H###  ######Y######?###################################?
#####  #######"###############@############################
X################# ###Click to edit Master title style#######!############!
#########
#
#########
#####D###
####H###  ######$\######?###################################?
#####  #######"############## ############################
[#####################Click to edit Master subtitle
style#######$############$#########
#
##########
#####D###
####6###  ######^#############################
#########"

######`#############]# #`#}########################
t#####################*####(###################c#######

#############

############################### #########
#
#########
#####D###
####6###  ######xe#############################
#########"

######`#############]###}################### ####
V#####################*##############################

###############

########### #
#########
#####D###
####6###  ######8i#############################

#########"

######`#############]# #`#}########################
V#####################*##############################

###############

########### #
#########
#####D###
##C#####  #####@#####A#####B####C####D#####E

###F####  ##########################8c###############################
######################@#####3#"###############################@####
###B#
#####D###
##s##*###D#####  ################jJ###############"################
## ###,#######$#################################
0###H#####
#####D###

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.#####
###+####ity##D=#####' ################################=###@#B#####
######+####### #################################

############################z######(##### ######################
###############r#####
######## ###S######  ######l|##############@##########
#`#}#######################

#################r#####
######## ###S######  ######@}##############@##########
#`##########################

#######################
#########
####B###  #########################################################
#######d
###############8##########_#_#_#P#P#T#1#0################################
##N##########_#_#_#P#P#T#9####0######(######################################
###########################S1 :
A
-A
T
-G
G
C
C
-A
T
A
n=10S2:
A
T
A
T
A
A
T
T
C
T
A
T
-m=12###########0############### ###########
#########$#############$#############
###########$#############$#############$############# #####
#####
##########$############# ###########$#######

##### ###########$#############$############# ###########


###########$#####33##### ########### ######### ###########$#######
##### ###########$############# ##########$#############
###########$############# ##### #####$############
###########`############# ###########################
######################## ###########/#####
#########
####<###  #########################################################
###################8##########_#_#_#P#P#T#1#0##########################
########N##########_#_#_#P#P#T#9####0######(################################
##################################The LCS is AATCAT. The length of the LCS
is 6. The solution is not unique for all pair of strings. Consider the pair
(ATTA, ATAT). The solutions are ATT, ATA. In general, for arbitrary pair of
strings, there may exist many solutions.##################### #########
########### #########$############# ########### ######### ###########
#########$############# #########`#######2#####$############### #####
##### ########### ########### #####M##### ############/###############
####################### ###########H#####
#########

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.#####2@###+##########D=#####'
################################=###@#B#####
######+#######}##################################

############################$######(##### ######################
###############r#####
######## ###S######  ######

##############@########## #`#}#######################

#################r#####
######## ###S######  ####################@##########
#`##########################

#################H#####
#########

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.######P.####+##########D=#####'
################################=###@#B##### ######+########
#################################

#1######)### #######################(##### ######################


###############r#####
######## ###S######  ######

##############@########## #`#}#######################

#################r#####
######## ###S######  ###### 0#########@############### #`#
#######################

#######################
#########
####B###  #########################################################
#######################8##########_#_#_#P#P#T#1#0####################
##############N##########_#_#_#P#P#T#9####0######(##########################
#######################################S1 :
A
-A
T
-G
G
C
C
-A
T
A
n=10S2:
A
T
A
T
A
A
T
T
C
T
A
T
-m=12###########0############### ###########
#########$#############$#############
###########$#############$#############$############# #####
#####
##########$############# ###########$#######

##### ###########$#############$############# ###########


###########$#####33##### ########### ######### ###########$#######
##### ###########$############# ##########$#############
###########$############# ##### #####$############
###########`############# ###########################
######################## ###########v#####
#########
####B###  ##########################################################
### #d################@##########_#_#_#P#P#T#1#0####
#####################################f##########_#_#_#P#P#T#9####H######@##
###################################################################
>#################6###G
-G
-C
---A
-T
-T######7#####0#################$#####33
##### ###########$#####33######
###########$#####33###### ###########`############# ##########

`##

########## ########0################### ###################


######################## ###########H#####
#########

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.#####P=###+##########D=#####'
################################=###@#B#####
######+#########################################

#l######d###0#######################(##### ######################
###############r#####
######## ###S######  ######)##############@##########
#`#}#######################

#################r#####
######## ###S######  ######*##############@##########
#`##########################

#################^#####
#########
####6###############################################################
###j####
#########
##S## ####A ##########g###?#####?#########"####?############
#@#
###

##########g######H#####
#########

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####c########################################

#l######d###@########### ###########(##### ######################


##### #########r#####
##### ## ###S######  #######0##############@##########
#`#}#######################

#################r#####
##### ## ###S######  ######0##############@##########
#`##########################

#################^#####
##### ###
####6###############################################################
###j####
##### ###
##S## ####A!##########h###?#####?#########"####?#############P###^

###

##########h######H#####
##### ###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####c#@W###w#################################

########P#########'#####w#####(##### ######################
#####$#########r#####
#####$## ###S######  ######C##############@##########
#`#}#######################

##################?##########
#### ######p###~#####
####'#############  #######"###################r###6#################N
##############################
####$###
####<###  ######M#####################################?############
#####p###~#####
D############################################################M####V###
##
####$###
####<###  ######xO#####################################?############V
#####
##~############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
X#####################!###:######### ####"
##d############'###############&###############
####$###
####<###  ######(H#####################################?############
#####V
##~#####
D############################################################M########
#
####$###
####<###  ######a#####################################?############;
#####
##~#####
D############################################################M####Z###
##
####$###
####<###  ######c#####################################?
##################;
##~############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
\#####################!A####<######### ####"
##d############'#################&###############
####$###
####<###  ######n#####################################?############!
#########~#####
D############################################################M########
#
####$###
####<###  ######w#####################################?
##################!###~#####
D############################################################M########
#
####$###
####<###  ######  # ####################################?
######################~#####
D############################################################M########
#
####$###
####<###  ############################################?
############z##########~#####
D############################################################M########
#
####$###
####<###  ###########################################?
##################z###~#####
D############################################################M########
#
####$###
####<###  ######X#####################################?
############`#########~#####
D############################################################M########
#

####$###
####<###  ######$#####################################?
##################`###~#####
D############################################################M########
#
####$###
####<###  ###########################################?
############F#########~#####
D############################################################M####V###
##
####$###
####<###  ###########################################?
##################F###~############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########X#####################!###:######### ####"
##d############'###############&###############
####$###
####<###  ###### #####################################?############+##
#######~#####
D############################################################M####V###
##
####$###
####<###  ###########################################?
##################+###~############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########X#####################!###:######### ####"
##d############'###############&###############
####$###
####<###  ######\#####################################?
######################~#####
D############################################################M########
#
####$###
####<###  ###########################################?############
##########~#####
D############################################################M########
#
####$###
####<###  ######` #####################################?############
#####p########
D############################################################M####U###
##
####$###
####<###  ######@ #####################################?############V
#####
##############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
W#####################A###:######### ####"
##d############'###############&###############
####$###
####<###  ###### #####################################?############
#####V
#######
D############################################################M####W###
##
####$###
####<###  ######H#####################################?############;
#####
##############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################T###<######### ####"
##d############'#################&###############
####$###

####<###  ###########################################?
##################; #######
D############################################################M####W###
##
####$###
####<###  ###########################################?############!
#####################z######0##########_#_#_#P#P#T#1#0#################
#########:##########_#_#_#P#P#T#9##################################
Y#####################A###<######### ####"
##d############'#################&###############
####$###
####<###  #############################################?
##################!########
D############################################################M####W###
##
####$###
####<###  ######x######################################?
##################################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################C###<######### ####"
##d############'#################&###############
####$###
####<###  ######`######################################?
############z###############
D############################################################M####W###
##
####$###
####<###  ######
#####################################?
##################z###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################T###<######### ####"
##d############'#################&###############
####$###
####<###  ############################################?
############`##############
D############################################################M####W###
##
####$###
####<###  #############################################?
##################`###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################A###<######### ####"
##d############'#################&###############
####$###
####<###  ######p)#####################################?
############F##############
D############################################################M####U###
##
####$###
####<###  ######P+#####################################?
##################F###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########W#####################A###:######### ####"
##d############'###############&###############
####$###
####<###  ######6#####################################?
############+##############
D############################################################M####U###
##
####$###
####<###  ######8#####################################?
##################+###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########W#####################T###:######### ####"

##d############'###############&##########U#####
####$###
####<###  #######;#####################################?
##################################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########W#####################=###:######### ####"
##d############'###############&##########j#####
####$###
####<###  ######LB#####################################?############
######################z######0##########_#_#_#P#P#T#1#0#################
#########:##########_#_#_#P#P#T#9##################################
l#####################S2###N######### ####"
##d############'###############/###############&###############
####$###
####<###  ######HF#####################################?############
#####p########
D############################################################M########
#
####$###
####<###  ######4W#####################################?############V
#####
#######
D############################################################M########
#
####$###
####<###  ######4`#####################################?############
#####V
#######
D############################################################M########
#
####$###
####<###  ######Z#####################################?############;
#####
#######
D############################################################M########
#
####$###
####<###  ######q#####################################?
##################; #######
D############################################################M########
#
####$###
####<###  ######`z#####################################?############!
##############
D############################################################M########
#
####$###
####<###  ############################################?
##################!########
D############################################################M####W###
##
####$###
####<###  ######(#####################################?
##################################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################T###<######### ####"
##d############'#################&###############
####$###
####<###  ###########################################?
############z###############
D############################################################M####W###
##
####$###
####<###  ###########################################?
##################z###############z######0##########_#_#_#P#P#T#1#0####

######################:##########_#_#_#P#P#T#9##########################
########Y#####################A###<######### ####"
##d############'#################&###############
####$###
####<###  ############################################?
############`##############
D############################################################M####W###
##
####$###
####<###  ######\#####################################?
##################`###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################C###<######### ####"
##d############'#################&###############
####$###
####<###  ###########################################?
############F##############
D############################################################M####W###
##
####$###
####<###  ######(#####################################?
##################F###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################T###<######### ####"
##d############'#################&###############
####$###
####<###  ######2#####################################?
############+##############
D############################################################M####W###
##
####$###
####<###  ###########################################?
##################+###############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################A###<######### ####"
##d############'#################&##########U#####
####$###
####<###  ###########################################?
##################################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########W#####################=###:######### ####"
##d############'###############&##########j#####
####$###
####<###  ######5#####################################?############
######################z######0##########_#_#_#P#P#T#1#0#################
#########:##########_#_#_#P#P#T#9##################################
l#####################S1###N######### ####"
##d############'###############/###############&##########Z###B#
####$###
##s##*#########1##########
#######?################# ######p#########Z###B#
####$###
##s##*#########1##########
#######?################# ###~###p###~######Z###B#
####$###
##s##*#########1##########
#######?################# ###### ###~######Z###B#
####$###
##s##*#########1##########
#######?#################p######p###~######Z###B#
####$###
##s##*#########1##########
#######?################# ######p#########Z###B#
####$###

##s##*#########1##########
#######?############################~######Z###B#
####$###
##s##*#########1##########
#######?##########################~######Z###B#
####$###
##s##*#########1##########
#######?#################+######+###~######Z###B#
####$###
##s##*#########1##########
#######?##########################~######Z###B#
#####%###
##s##*#########1##########
#######?#################F######F###~######Z###B#
#####%###
##s##*#########1##########
#######?##########################~######Z###B#
#####%###
##s##*#########1##########
#######?#################`######`###~######Z###B#
#### %###
##s##*#########1##########
#######?##########################~######Z###B#
####

%###
##s##*#########1##########
#######?#################z######z###~######Z###B#
#####%###
##s##*#########1##########
#######?############################~######Z###B#
#####%###
##s##*#########1##########
#######?##########################~######Z###B#
#####%###
##s##*#########1##########
#######?#################!######!###~######Z###B#
#####%###
##s##*#########1##########
#######?##########################~######Z###B#
#####%###
##s##*#########1##########
#######?#################; #####;
##~######Z###B#
#####%###
##s##*#########1##########
#######?################# #####
##~######Z###B#
####!%###
##s##*#########1##########
#######?#################V
#####V
##~######Z###B#
####$%###
##s##*#########1##########
#######?#################
#####
##~######Z###B#
####(%###
##s##*#########1##########
#######?################# ######p#########w########## ####`###P###
###B#####
####'#############  #######"2########&#############################
############`# ##########################W#####
####&###
####<###  ###########################################?
###############O###
###B############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################5###<#########(####"
##d##############'###############&##########W#####
####  &###
####<###  ######`#####################################?
###############O######B############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################5###<#########(####"
##d##############'###############&##########W#####
####~&###
####<###  ######` #####################################?
############d###O######B############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################4###<#########(####"
##d##############'###############&##########W#####
####}&###
####<###  ###### #####################################?############

##O###d###B############z######0##########_#_#_#P#P#T#1#0##################
########:##########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####|&###
####<###  ###########################################?
############<###O###

##B############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####{&###
####<###  ############################################?############
##O###<###B############z######0##########_#_#_#P#P#T#1#0##################
########:##########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####z&###
####<###  ###########################################?
################O###
##B############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####y&###
####<###  ###########################################?
###############O#######B############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################1###<#########(####"
##d##############'###############&##########W#####
####x&###
####<###  ######|#####################################?
###############O######B############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################0###<#########(####"
##d##############'###############&##########W#####
####w&###
####<###  ######h#####################################?
############`###O######B############z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################T 6###:######### ####"
##d############'###############&##########W#####
####v&###
####<###  #############################################?
###############\##
###O############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################5###<#########(####"
##d##############'###############&##########W#####
####u&###
####<###  ############################################?
###############\
#####O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####t&###
####<###  ############################################?
############d###\
#####O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####s&###
####<###  #######

#####################################?############

##\
##d###O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####r&###
####<###  ############################################?
############<###\##

##O############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####q&###
####<###  ######(######################################?############
##\
##<###O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####p&###
####<###  ############################################?
################\##
##O############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####o&###
####<###  ############################################?
###############\
######O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####n&###
####<###  ######(!#####################################?
###############\
#####O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####m&###
####<###  ######(#####################################?
############`###\
#####O############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################A 5###:######### ####"
##d############'###############&##########W#####
####l&###
####<###  ######\)#####################################?
###############i

## ###\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####k&###
####<###  ######L2#####################################?
###############i

#####\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####j&###
####<###  ######6#####################################?
############d###i

#####\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################4###<#########(####"
##d##############'###############&##########W#####
####i&###
####<###  ######9#####################################?############

##i

##d###\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####h&###
####<###  ######?#####################################?
############<###i

##

##\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####g&###
####<###  ######\A#####################################?############
##i

##<###\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####f&###
####<###  ######E#####################################?
################i

##
##\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####e&###
####<###  ######K#####################################?
###############i

######\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####d&###
####<###  ######|O#####################################?
###############i

#####\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####c&###
####<###  ######hS#####################################?
############`###i

#####\
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################A 4###:######### ####"
##d############'###############&##########W#####
####b&###
####<###  ######[#####################################?
###############v### ###i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####a&###
####<###  ###### T#####################################?
###############v######i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####`&###
####<###  ######d\#####################################?
############d###v######i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####_&###
####<###  ######h#####################################?############

##v###d###i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################3###<#########(####"
##d##############'###############&##########W#####
####^&###
####<###  ######Dm#####################################?
############<###v###

##i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####]&###
####<###  ######4q#####################################?############
##v###<###i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####\&###
####<###  ######q#####################################?
################v### ##i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####[&###
####<###  ######x#####################################?
###############v#######i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####Z&###
####<###  ######  # ####################################?
###############v######i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####Y&###
####<###  ###########################################?
############`###v######i

###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################C 3###:######### ####"
##d############'###############&##########W#####
####X&###
####<###  ######$#####################################?
###############
##
###v############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####W&###
####<###  ###########################################?
###############
#####v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####V&###
####<###  ###### #####################################?
############d###
#####v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####U&###
####<###  ###########################################?############

##
##d###v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####T&###
####<###  ############################################?
############<###
##

##v############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################2###<#########(####"
##d##############'###############&##########W#####
####S&###
####<###  ###########################################?############
##
##<###v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####R&###
####<###  ######x#####################################?
################
##
##v############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####Q&###
####<###  ######X#####################################?
###############
######v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####P&###
####<###  ######0#####################################?
###############
#####v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####O&###
####<###  ######h#####################################?
############`###
#####v############z######0##########_#_#_#P#P#T#1#0######################
####:##########_#_#_#P#P#T#9##################################
Y#####################T 2###:######### ####"
##d############'###############&##########W#####
####N&###
####<###  ###########################################?
###############
## ###
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####M&###
####<###  ######<#####################################?
###############
#####
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####L&###
####<###  ############################################?
############d###
#####
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####K&###
####<###  ###########################################?############

##
##d###
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####J&###
####<###  ###########################################?
############<###
##

##
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####I&###
####<###  ###########################################?############
##
##<###
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####H&###
####<###  ######

#####################################?################ ##
##
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################1###<#########(####"
##d##############'###############&##########W#####
####G&###
####<###  ######H#####################################?
###############
######
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####F&###
####<###  ######x #####################################?
###############
#####
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####E&###
####<###  ###### #####################################?
############`###
#####
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################A 1###:######### ####"
##d############'###############&##########W#####
####D&###
####<###  ###### #####################################?
################## ###
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####C&###
####<###  ######0 #####################################?
#####################
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####B&###
####<###  ######8#####################################?
############d#########
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####A&###
####<###  ######0#####################################?############

#####d###
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####@&###
####<###  ###########################################?
############<######

##
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####?&###
####<###  ######(#####################################?############
#####<###
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####>&###
####<###  #############################################?
################### ##
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####=&###
####<###  ############################################?
######################
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########W#####
####<&###
####<###  ######
#####################################?#####################
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
Y#####################0###<#########(####"
##d##############'###############&##########U#####
####;&###
####<###  ######x#####################################?
############`#########
###########z######0##########_#_#_#P#P#T#1#0##########################:##
########_#_#_#P#P#T#9##################################
W#####################0###:######### ####"
##d############'###############&###############
####:&###
####<###  ############################################?
###############P###
###############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
#####################A8###l#########(####" ##d##############(
###" ##d################'#################'###############&###############
####9&###
####<###  ######L######################################?
###############P##################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
#############################T7###l#########(####" ##d##############(
###" ##d################'#################'###############&###############
####8&###
####<###  ######$######################################?
############d###P##################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
#############################A6###l#########(####" ##d##############(

###" ##d################'#################'###############&###############
####7&###
####<###  ###### ######################################?############

##P###d###############z######0##########_#_#_#P#P#T#1#0##################
########:##########_#_#_#P#P#T#9##################################
#####################C5###l#########(####" ##d##############(
###" ##d################'#################'###############&###############
####6&###
####<###  ######x)#####################################?
############<###P###

##############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
#####################T4###l#########(####" ##d##############(
###" ##d################'#################'###############&###############
####5&###
####<###  ############################################?############
##P###<###############z######0##########_#_#_#P#P#T#1#0##################
########:##########_#_#_#P#P#T#9##################################
#####################A3###l#########(####" ##d##############(
###" ##d################'#################'###############&###############
####4&###
####<###  #######7#####################################?
################P###
##############z######0##########_#_#_#P#P#T#1#0#########################
#:##########_#_#_#P#P#T#9##################################
#####################A2###l#########(####" ##d##############(
###" ##d################'#################'###############&###############
####3&###
####<###  ######>#####################################?
###############P###################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
#############################T1###l#########(####" ##d##############(
###" ##d################'#################'###############&##########W#####
####2&###
####<###  ######T=#####################################?
###############P##################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
########Y#####################0###<#########(####"
##d##############'###############&###############
####1&###
####<###  ######=#####################################?
############`###P##################z######0##########_#_#_#P#P#T#1#0####
######################:##########_#_#_#P#P#T#9##########################
#############################ji###|######### ####" ##d############
###"
##d##############'#################'###############'#################&######
####T###B#
####&###
##c##$################
#######?#################`###P### ###P######Z###B#
####&###
##s##*#########1##########
#######?#################`###B### ###B######T###B#
####&###
##c##$################
#######?#################`###P###`###B######Z###B#
####&###
##s##*#########1##########
#######?################# ###P### ###B######Z###B#
####&###
##s##*#########1##########
#######?#################`###### #########Z###B#
####&###
##s##*#########1##########
#######?####################P######B######Z###B#
####&###
##s##*#########1##########
#######?####################P######B######Z###B#
####&###
##s##*#########1##########
#######?#####################P#######B######Z###B#
####&###

##s##*#########1##########
#######?################# ##P###
##B######Z###B#
####&###
##s##*#########1##########
#######?#################<###P###<###B######Z###B#
####&###
##s##*#########1##########
#######?#################

##P###

##B######Z###B#
####&###
##s##*#########1##########
#######?#################d###P###d###B######Z###B#
####&###
##s##*#########1##########
#######?####################P######B######Z###B#
####&###
##s##*#########1##########
#######?####################P######B######Z###B#
####&###
##s##*#########1##########
#######?#################`###
## ###
#####Z###B#
####&###
##s##*#########1##########
#######?#################`###
## ###
#####Z###B#
#####'###
##s##*#########1##########
#######?#################`###v### ###v######Z###B#
####5'###
##s##*#########1##########
#######?#################`###i

## ###i

#####Z###B#
####e'###
##s##*#########1##########
#######?#################`###\## ###\#####Z###B#
####'###
##s##*#########1##########
#######?#################`###O### ###O######H#####
#####$###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####c#0Dn###2##################################

#####################0#####2######(##### ######################
#####0##############
#####0## ###S######  ######Q##############@##########
#`#}#####################################################r#####
#####0## ###S######  #######E##############@##########
#`##########################

#################H#####
#####0###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####d# #j###$##################################

#####################4#####$######(##### ######################
#####4#########r#####
#####4## ###S######  ######$###############@##########
#`#}#######################

#################r#####
#####4## ###S######  #####################@##########
#`##########################

#################H#####
#####4###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####d##F####$##################################

#####################8#####$######(##### ######################
#####8#########r#####
#####8## ###S######  ######vG##############@##########
#`#}####################G###

#################r#####
#####8## ###S######  ######|ZG##############@##########
#`#######################G###

#################H#####
#####8###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####d#

###$##################################

#####################<#####$######(##### ######################
#####<#########r#####
#####<## ###S######  #####################@##########
#`#}#######################

#################r#####
#####<## ###S######  ######<%##############@##########
#`##########################

#################H#####
#####<###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####d# =S###U##################################

#l######d##############@###########(##### ######################
#####@#########r#####
#####@## ###S######  ######0###############@##########
#`#}#######################

#################r#####
#####@## ###S######  ######D##############@##########
#`##########################

#################^#####
#####@###
####6###############################################################
###j####
#####@###
##S## ####A"##########i###?#####?#########"####?############ ####+####

##########i######H#####
#####@###

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.####e#
?###+##########D=#####' ################################=###@#B#####
######+#######$##################################

#####################D#####$######(##### ######################
#####D#########r#####
#####D## ###S######  ######P##############@##########
#`#}#######################

#################r#####
#####D## ###S######  ######$##############@##########
#`##########################

#################H#####
#####D###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####e#####$##################################

#####################H#####$######(##### ######################
#####H#########r#####
#####H## ###S######  ###### ##############@########## #`#}#############
##########

#################r#####
#####H## ###S######  ######!##############@##########
#`##########################

#################H#####
#####H###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####f#######################################

#l######d##############L###########(##### ######################
#####L#########r#####
#####L## ###S######  #####################@##########
#`#}#######################

#################r#####
#####L## ###S######  ###### ##############@########## #`###############
###########

#################^#####
#####L###
####6###############################################################
###j####
#####L###
##S## ####A###########j###?#####?#########"####?################

###

##########j######H#####
#####L###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####f#D`###}##################################

######################P#####$######(##### ######################
#####P#########r#####
#####P## ###S######  ####################@##########
#`#}#######################

#################r#####
#####P## ###S######  ####################@##########
#`##########################

#################H#####
#####P###

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.####f# ^4###+##########D=#####'
################################=###@#B#####
######+#######}##################################

######################T#####$######(##### ######################
#####T#########r#####
#####T## ###S######  ######p##############@##########
#`#}#######################

#################r#####
#####T## ###S######  ######`##############@##########
#`##########################

#################H#####
#####T###

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.####g#::###+##########D=#####'
################################=###@#B##### ######+#######

#################################

########## ###########X#####V######(##### ######################


#####X#########r#####
#####X## ###S######  ###### ##############@##########
#`#}#######################

#################G

##

#####X###
####0####$############################################# ###
###############x##########_#_#_#P#P#T#1#0####X######P####################
#############################################################################_
#_#_#P#P#T#9################################################################
################################################################################
################################################################################
#######################A#################### i=1
x1=5
L={(5,1)}
D1=(5)
2
3
{(3,1)}
(5,3)
3
4
{(3,1),(4,2)}
(5,3)
D2=(4)
4
9
{(3,1),(4,2),(9,3)}
(5,3)
(4) D3=(9)
5
6
{(3,1),(4,2),(6,3)}
(5,3)
(4) (9,6)
6
2
{(2,1),(4,2),(6,3)
(5,3,2)
(4) (9,6)
7
1
{(1,1),(4,2),(6,3)}
(5,3,2,1)
(4)
(9,6)
8
8
{(1,1),(4,2),(6,3),(8,4)}
(5,3,2,1)
(4)
(9,6) D4=(8)
9
7
####&#############&#########$#####&#############f#################&#########
######&##############&###############&#########H#####&##############

f##

##############&###############&#########H#####&###############f###########
#####&###############f###########Z#### &## ###########$f##$########

####(&##(###########,f##,########
####0&##0###########0&##0######F####0&##0###########4f##4########
####8&##8###########<f##<########

#####&#############&#########O#####&#############f###########
#####&###############&###############&###############&###############7####
########### ###################
###^###############
##################
###Z###############
###

###############
###U###############
##################
###'#################4###############
##############U###

#####X###
####0####$############################################
#########################The x-component of the list, if separated, will
look like the following during execution: (5),(3),(3,4), (3,4,9), (3,4,6),
(2,4,6),(1,4,6), (1,4,6,7),
(1,4,6,7,10)###6########0###############"###########"############"########H#
####
#####X###

####0################ h############# ###?########


########___##f3##
##;/#f##9####################_#_#_#P#P#T#1#0####i##
###.####g#`0&P###+##########D=#####'
################################=###@#B#####
######+#######$##################################

##########0###########\#####$######(##### ######################
#####\#########r#####
#####\## ###S######  #####################@##########
#`#}#######################

#################r#####
#####\## ###S######  ######d###############@##########
#`##########################

#################H#####
#####\###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####g#`###$##################################

##########@###########`#####$######(##### ######################
#####`#########r#####
#####`## ###S######  ######################@##########
#`#}#######################

#################r#####
#####`## ###S######  #####################@##########
#`##########################

#################H#####
#####`###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####h##f7###$##################################

##########P###########d#####$######(##### ######################
#####d#########r#####
#####d## ###S######  #####################@##########
#`#}#######################

#################r#####
#####d## ###S######  #####################@##########
#`##########################

#################H#####
#####d###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####h#=###$##################################

##########`###########h#####$######(##### ######################
#####h#########r#####
#####h## ###S######  #######7##############@##########
#`#}#######################

#################r#####
#####h## ###S######  ######7##############@##########
#`##########################

#################H#####
#####h###

####0################ h############# ###?########


########___##f3##
##;/#f##9####8######0##########_#_#_#P#P#T#1#0#######
###.####h#8X########

##xp^R####3

lHbP

##

LP!##1#4#ax####%

y@#(##Xy#T#0c##H!me  #f)

##C>##@2##EB@A^#XAlfO##A`?
r #4 `y # # #### "##### # 8 L . / O +Qp- ,M, S 0 3 ` # J
##|#GBb]L##d#@{#5pQ'Q
A
9#Hk#<
-a#d##
##<##<##e#C"C1+b#P####@###ODXA6pe(d(##hc>

R`*##l/#S#

e##@####`#######xVAk#A#~h5hbA<

9f##LTl#V0G)M7
%dJ##OP##<xR   j 7 &d#E#/3yofy3^9##2t

0#g#$1z#

?R#E9M##~\P##&K@tty=>I0# ^xUyr#j`#3##$#Of!
 # oA# #@9*{#OI|#75B|kX >-NMe14)N  # (Mc
%yZv[5#U6]#_#W 6#X
AV#9Z7+M KK]/C/r##
%qm##&o3 {Vl#rVX##Mvpc{#[,T,z]VwihV:#w# #"#
%E#Q;@j_#y##^#v!p
3d^#l/C#@#
J]
X}l##2)IjSJLQ#79~R#ej

i##f@@q##`m#MGCC8 wl##n,#-a#########

##xVk#A## AA<,#=,B###B{%#m
i@)##A7###TPI=y,c#/17lXsx){73;K|l|s##"#0#|YW#0

#w8=%?i)#####<#TG9~[>OoWs_/=`M)10
~#Os#xu}[{JoW:<
W/#75#]k##s###]C#cSs  o {woOY[#J+KjM#8
##G#  # WT]ETb#2##mnrtyRl K#fj?
#M<w=vPcMve#z# #F##2H3s}|~W]NQw+1mm $"g G3
##)J#TK6 ~#o5S{[[s#LJ<j\=rf"Vxz  ,W=K21

e/#Y####A####

##xVk#A#f&V
xJ
##B{$nfSZK#A#T#PP##+xYIf n}of|
##.:#f#{"6aEC4z3##iGOJ|P{h##4rpt#  #y#l_
k#zZ(#!#J=#)#70E.9?z+zOqe3W&5~O~7C~]kM?
`|}##^#WZ
##gr^(1()j^?
} *e/#]q#q#lA " l [# M K u # V 7' H *
D9 #q
q
.`%c####q#?b#gGD#eYBH,A####r#%  XOC[

%#S+:K9>%#PkI

G_3)3ed=heq?
7l5S7\CgRyD#2mXE)#hZ0& i' #dxu##r#|###########
# #i##uu##V##s}##N## ##d 
# # ### ######|
Q####S##U###X##:Z##]##_####a##d##xg##i##v##x##

{##8}#############?
#################C####i#####(####################
####################
######
#####'#######################################g#######Y##############E#q#u#a
#t#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t#
#E#q#u#a#t#i#o#n#
#3#.#0#####################################h#######[##############E#q#u#a#t
#i#o#n#
######E#q#u#a#t#i#o#n#.#3#0##,###M#i##########################Oh###+'
0###4%#########p#######x######################## #############
#############

##########################$##################PowerPoint
Presentation##########owe########Edge#Poi########
#ge########126#########Microsoft PowerPoint#on#@### /)
+k###@###########@###########@###TSh########G####$#########g

####

########R###########################

#######################-###################-###

###@ !#############################-##############'###################
######-####################-###
###%###)#[#)##########-#######-##############'###################
#############-#######%###2########-#####################'##################@##Garamond###################################.############### ##f3#.###2
Y#<#####Longest Common Subsequence!###############%###-##################################.########################"System###########
###########################################@##Wingdings##################################.############### ##
##
###2
#<#####n#######.##################################@##Arial######################################.############### #########2
#b#

###Definition: ######

###

##

#############.##################################@##Arial######################################.############### ########2
#<#####The ######

#####.##################################@##Arial######################################.############### ##
######2
######longest common ##############

#####%#%###########.##################################@##Arial######################################.############### ##
######2
##b#####subsequencem##########################.##################################@##Arial######################################.############### #####

###2
#######or ###########.##################################@##Arial######################################.############### ##
##

###2
#######LCS###########.##################################@##Arial######################################.############### #########2
########of two strings ##

#####

###

###
#######

#####.##################################@##Arial######################################.############### #####

###2
########S1 #####

#####.##################################@##Arial######################################.############### ########2
##X#####and ############.##################################@##Arial######################################.############### #####

###2
@#b#####S2 #####

#####.##################################@##Arial######################################.############### #####:###2
@##"###is the longest subsequence common
###

#######
###########

#######################

#######$###########.##################################@##Arial######################################.############### #####%###2
r#b#####between two strings.####

#########

#####

###

###
#######

#####.##################################@##Arial######################################.############### #####

###2
#M#####S1 ###########.##################################@##Arial######################################.############### ########2
#s#####:
############.##################################@##Arial######################################.############### #### ###2
######A#######.##################################@##Arial######################################.############### #####
###2
######--########.##################################@##Arial######################################.############### #### ###2
######A#######.##################################@##Arial######################################.############### #### ###2
#+#####T#######.##################################@##Arial######################################.############### #####
###2
#V#####--########.##################################@##Arial######################################.############### ########2
#####G
G
C###############################.##################################@##Arial######################################.############### #### ###2
#######C#######.##################################@##Arial######################################.############### #####
###2
#_#####--########.##################################@##Arial######################################.############### ########2
######A
####################.##################################@##Arial######################################.############### #### ###2
######T#######.##################################@##Arial######################################.############### #33# ###2
#######A#######.##################################@##Arial######################################.############### ########2
#V#####n=10############.##################################@##Arial######################################.############### #########2
#M#####S2:
##################.##################################@##Arial######################################.############### #### ###2
######A#######.##################################@##Arial######################################.############### #########2
######T
################.##################################@##Arial######################################.############### ########2
######A
T####################.##################################@##Arial######################################.############### #########2
#a#####A
##############.##################################@##Arial######################################.############### ########2
#####A
T
T###############################.##################################@##Arial######################################.############### #### ###2

#%#####C#######.##################################@##Arial######################################.############### ########2
#h#####T
############.##################################@##Arial######################################.############### ########2
## ###A
T#######################.##################################@##Arial######################################.############### #####
###2
#######--########.##################################@##Arial######################################.############### ########2
#U#####m=12###########.##################################@##Arial######################################.############### ########2

#U#####The ############.##################################@##Arial######################################.############### #####

###2

######LCS###########.##################################@##Arial######################################.############### #####

###2

######is ##########.##################################@##Arial######################################.############### ########2

######AATCAT################.##################################@##Arial######################################.############### ##### ###2

#;#####.#######.##################################@##Arial######################################.############### #####"###2

#I#####The length of the ########################################.##################################@##Arial######################################.############### #####

###2

#######LCS###########.##################################@##Arial######################################.############### #####

###2

#C#####is ##########.##################################@##Arial######################################.############### ##
##
###2

#\#####6#######.##################################@##Arial######################################.############### #####
###2

#j#####. ########.##################################@##Arial######################################.############### ##
##R###2
*#U#2###The solution is not unique for all pair of strings########
#########################################################################
################.##################################@##Arial######################################.############### #####'###2
*#T#####. Consider the pair (##########
###################################.##################################@##Arial######################################.############### #########2
*#/#####ATTA, ################.##################################@##Arial######################################.############### ########2
H#U#####ATAT############.##################################@##Arial######################################.############### #####(###2
H######). The solutions are ###############################
###############.##################################@##Arial######################################.############### #########2
H#y#####ATT, ATA####################.##################################@##Arial######################################.############### #####=###2
H##$###. In general, for arbitrary pair of
####################################################

#######################.##################################@##Arial######################################.############### #####C###2
f#U#(###strings, there may exist many solutions.################################

####################

#########################.######################################################################################
################################################################################
#############R#o#o#t#
#E#n#t#r#y######################################################dO#
##)#############E#############P#i#c#t#u#r#e#s#####################################################
####################################################C#u#r#r#e#n#t#
#U#s#e#r############################################################
#########################2#########S#u#m#m#a#r#y#I#n#f#o#r#m#a#t#i#o#n##########
#################(##################################################d
%############################################################
############################################################
############################################################
############################################################
######################################################
#########
#########################################################
###
#######

###
#######################

#################
###############
###
#######

##############################################################################
###!###"#######$###
%###&###'###(###)###*###+###.######

ed#################Design
Template#################Embedded OLE Servers################Slide
Titles############D###########
#######4#######<###############Version######################################_
##########KRUNAL####K#R#U#N#A#L##############################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
############_#y#######O# ####
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################

################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
##########
###
#######

##############################################################################
###!###"#######$###%###&###'###(###)###*###+###,######.###/###0###1###2###3###4###5###6###7###8###9###:###;###<###=###>###?
###@###A###B###C###D###E###F###G###H###I###J###K###L###M###N###O###P###Q###R###S
###T###U###V###W###X###Y###Z###[###\###]###^###_###`###a###b###c###d###e###f###g
###h###i###j###k###l###m###n###o###p###q###r###s###t###u###v###w###x###y###z###{
###|
###}###~######################################################
############################################################
############################################################
############################################################
############################################################
###
##################################R#o#o#t#
#E#n#t#r#y######################################################dO#
##)############`Sh############P#i#c#t#u#r#e#s#####################################################
####################################################C#u#r#r#e#n#t#
#U#s#e#r############################################################
###################################S#u#m#m#a#r#y#I#n#f#o#r#m#a#t#i#o#n##########
#################(##################################################d
%######P#o#w#e#r#P#o#i#n#t#
#D#o#c#u#m#e#n#t###########################(########################
###########################D#o#c#u#m#e#n#t#S#u#m#m#a#r#y#I#n#f#o#r#m#a#t#i#o#n
###########8###########################################################
####################################################################
################################################################################
####################################################################
############c#r#o#s#o#f#t# #E#q#u#a#t#i#o#n#
#3#.#0#####################################i#######_##############E#q#u#a#t
#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t# #E#q#u#a#t#i#o#n#
#3#.#0#####################################j#######f##############E#q#u#a#t
#i#o#n# ######E#q#u#a#t#i#o#n#.#3#0##,###M#i#c#r#o#s#o#f#t# #E#q#u#a#t#i#o#n#
#3#.#0####L###/##

###0#############|
######D###A#r#i#a#l#####g#s###B##B##6I#LA##4A####0########LA##z[
0DA#########D###G#a#r#a#m#o#n#d#####B##B##6I#LA##4A####0########LA##z[
0DA###### ##D###T#i#m#e#s# #N#e#w#
#R#o#m#a#n###LA##4A####0########LA##z[
0DA######0##D###W#i#n#g#d#i#n#g#s###R#o#m#a#n###LA##4A####0########LA##z[
0DA######@##D###S#i#m#S#u#n###g#s###R#o#m#a#n###LA##4A####0########LA##z[
0DA########
####`##############0#.################
#########
###@##n#####?###"
##d######d#########@########################## #
#########@#@#########`#`#################################################
################################################################################
########################################

###

######
#######################################################
###############################################################
#######
##############################################################################
###############################################################

#######################################

###############################y###############w###############e###############
#######
###@#######A#######B#######C#######D#######E######################H#######I####
###J#######K#######L#######M#######N#######O#######P#######Q#######R#######S####
###T#######U#######V############################################################
#######################
#####################################################m###############
###############################
################################################################################
#######
#######

#######################################################################
###############################################
#######
#######################################################
###############
###########################################################################X####
###W#######?
#########$#########################################$#######################
##################$#########################################$################
#########################$#########################################$########
#################################$#########################################$
#########################################$###################################
######$#########################################$###########################
##############$#########################################$####################
#####################$#########################################$############
#############################$#########################################$####
#####################################$#######################################
##$#########################################$###############################
##########$#########################################$#######################
##################$#########################################$################
#########################$#########################################$########
#################################$#########################################$
#########################################$###################################
######$#########################################$###########################
###########2##$######i
x
ZI,#j#]###############2##$#####`
##/#p#########]#######2##$######TW]#F#E#N########k#######2##$###
##a#k
%#6HG#x#################0#############A##############A##########
#####0##

#########33#@########################8##########
###############################################c####################;#
#;#######g################4###A###d###A###d###########dA##################
################ ###
#######

##############################################################################
###!###"#######$###
%###&###'###(###)###*###+###.###/###

z[
0########^####p##########p###p##########@##############

###################<######4###d###d###d###d#######A##<
0B##########################<######4###B###d###B###d#######A##<
0B##############X##########$#################_#_#_#P#P#T#1#0############
####D###S#i#m#S#u#n###e#w# #B##B######@##@####0########@##z[
0@########D###A#r#i#a#l#####e#w#
#B##B######@##@####0########@##z[ 0@###### ##D###T#i#m#e#s# #N#e#w#
#R#o#m#a#n###@##@####0########@##z[ 0@###################?##

###########%#####V#########V###########.#########################Longest
Common Subsequence### ###################`##############################
############################Definition: The longest common subsequence
or LCS of two strings S1 and S2 is the longest subsequence common between two
strings.
###########################

################################################################################
#####################7#############`########### two strings S1 and S2 is the
longest subsequence common between two strings.
###########################

################################################################################
#####################7#############`##########################################
#######
##################W###########/#########################LCS
Theorem### ###

###############`##############################
############################T#h#e# #L#C#S# # #c#a#n# #b#e# #f#o#u#n#d#
#b#y# #d#y#n#a#m#i#c# #p#r#o#g#r#a#m#m#i#n#g# #f#o#r#m#u#l#a#t#i#o#n#.# #O#n#e#
#c#a#n# #e#a#s#i#l#y# #s#h#o#w#:##T#h#e#o#r#e#m#:# #W#i#t#h# #a# #s#c#o#r#e#
#o#f# #1# #f#o#r# #e#a#c#h# #m#a#t#c#h# #a#n#d# #a# #z#e#r#o# #f#o#r# #e#a#c#h#
#m#i#s#m#a#t#c#h# #o#r# #s#p#a#c#e# #,# #t#h#e# #m#a#t#c#h#e#d#
#c#h#a#r#a#c#t#e#r#s# #i#n# #a#n# #a#l#i#g#n#m#e#n#t# #o#f# #m#a#x#i#m#u#m#
#v#a#l#u#e# #f#o#r# #a# #L#C#S#.##S#i#n#c#e# #i#t# #i#s# #u#s#i#n#g# #t#h#e#
#g#e#n#e#r#a#l# #d#y#n#a#m#i#c# #p#r#o#g#r#a#m#m#i#n#g# #a#l#g#o#r#i#t#h#m#
#i#t#s# #c#o#m#p#l#e#x#i#t#y# #i#s# #O#(#n#m#)# #.##A# #l#o#n#g#e#s#t#
#s#u#b#s#t#r#i#n#g# #p#r#o#b#l#e#m#,# #o#n# #t#h#e# #o#t#h#e#r# #h#a#n#d#
#h#a#s# #a# #O#(#n#+#m#)# #s#o#l#u#t#i#o#n#.# #S#u#b#s#e#q#u#e#n#c#e#s# #a#r#e#
#m#u#c#h# #m#o#r#e# #c#o#m#p#l#e#x# #t#h#a#n# #s#u#b#s#t#r#i#n#g#s#.# ##C#a#n#
#w#e# #d#o# #b#e#t#t#e#r# #f#o#r# #t#h#e# #L#C#S# #p#r#o#b#l#e#m#?# #W#e#
#w#i#l#l# #s#e#e# #&
####"###O#########Z##########Z###########Z#######################F############
#########
######################################b#########M##############################
##############

b##

##################4#######################>#################b#########1#########
########b############## ### #####|##################
###N#################################
###7#################@###############
###1###############
##################X###########0###################################The
optimal alignment is shown above. Note the alignment shows three insert (dark),
one delete green) and three substitution or replacement operations (blue), which
gives an edit distance of 7. But, the 3 replacement operations can be realized
by 3 insert and 3 delete operations because a replacement is equivalent to first
delete the character and then insert a character in its place
like:###n############Z#_###############b#####################332############
####

b##

##############################################################################b
#########
#################f################## ### ####### ### ########### ###
#######$f##$###############$b##$###########(###(###########(###(#######,f##,####
###########,b##,###########0###0######}####0###0########_###############
###7###############
###+###############
###
###############
###+###############
###################
#################Z###########1####################################if
we give a cost of 2 for replace operation and cost of 1 for both insert and
delete operations, the minimum edit distance D can be computed in terms of the
length L of LCS as:
For the above example, n=10, m=12,
L=6. So, D=10 ( 6 insert and 4 delete).
############################L###############################"#################
######################'#################(###################################
################################################################################
##########################################\###########2#####################1
###Direct Computation of LCS by Dynamic
Programming######2###############b#####&###########&#######b#######&######

###

&######

###

&######

###

&#######b#######&###########&#######b#######&###########&####P###########
###################
###################
###################
############################More efficient although the asymptotic
complexity remains the same, O(nm). Let L denote The equations are given below
without proof (which is simple).Again, if we leave suitable back pointers in the
matrix, trace(s) can be derived for the
LCS.###############Z#######b#######C#########################################
####################################################b##############

###

##

####

###

##>####

###

########b###############b#########Y######################################`#####
######
###C#################################
###K###############
###9################################]###########3#####################`###E#x
#a#m#p#l#e# #3#:# #E#d#i#t# #D#i#s#t#a#n#c#e# ###
#
#
#=# #6# #+# #8#
## #2#*#5# # #=# #4# ####L###1#########
#######&#######b#######&###########&######

b##

####&###########&####0###
###############
###################
##################^###########4#########################A Faster
Algorithm for LCS###################################################P###A#n#
#a#l#g#o#r#i#t#h#m# #t#h#a#t# #i#s# #a#s#y#m#p#t#o#t#i#c#a#l#l#y# #b#e#t#t#e#r#
#t#h#a#n# #O#(#n#m#)# # #f#o#r# #d#e#t#e#r#m#i#n#i#n#g# #L#C#S#.# #
#I#m#p#l#i#e#s# #t#h#a#t# #f#o#r# #s#p#e#c#i#a#l# #c#a#s#e#s# #o#f# #e#d#i#t#
#d#i#s#t#a#n#c#e#,# #t#h#e#r#e# #e#x#i#s#t# #m#o#r#e# #e#f#f#i#c#i#e#n#t#
#a#l#g#o#r#i#t#h#m#.##D#e#f#i#n#i#t#i#o#n#:# ##L#e#t# ## #b#e# #a# #s#e#t#
#o#f# #n# #i#n#t#e#g#e#r#s#,# #n#o#t# #n#e#c#e#s#s#a#r#i#l#y#
#d#i#s#t#i#n#c#t#.##D#e#f#i#n#i#t#i#o#n#:# ##A#n# #i#n#c#r#e#a#s#i#n#g#
#s#u#b#s#e#q#u#e#n#c#e#(#I#S#)# #o#f# ## #i#s# #a# #s#u#b#s#e#q#u#e#n#c#e#
#o#f# ## #w#h#o#s#e# #v#a#l#u#e#s# #a#r#e# #s#t#r#i#c#t#l#y#
#i#n#c#r#e#a#s#i#n#g# #f#r#o#m# #l#e#f#t# #t#o# #r#i#g#h#t#.##E#x#a#m#p#l#e#:#
##=#(#5#,#3#,#4#,#4#,# #9#,#6#,#2#,#1#,#8#,#7#,#1#0#)#.# #
#I#S#=#(#3#,#4#,#6#,#8#,#1#0#)#,#
#(#5#,#9#,#1#0#)################Z#8#########Z#
#########Z#r#########Z#A#########Z#######b#######/##############################
###########################################################b#########.####

###

########b#########&#################b#########

################ b## ###########$###$#######$###$##%####$###$##

####$###$#######(b##(###########,###,#######,###,#######,###,###########,###,###
####,###,#######,###,##)####,###,#######,###,###########,###,#######,###,##'####
0###0#######0###0#######0###0################
###/#################################
###.###############
###&###############
###

###############

###D###############

###################################`###########5############################
#######D#e#f#i#n#i#t#i#o#n#:# ##A# #l#o#n#g#e#s#t# #i#n#c#r#e#a#s#i#n#g#
#s#u#b#s#e#q#u#e#n#c#e#(#L#I#S#)# #o#f# ## #i#s# #a#n# #I#S# ## #o#f#
#m#a#x#i#m#u#m# #l#e#n#g#t#h#.##D#e#f#i#n#i#t#i#o#n#:# ##A#
#d#e#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e# #(#D#S#)# #o#f# ## #i#s# #a#
#n#o#n#-#i#n#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e# #f# ##.##E#x#a#m#p#l#e#:#
#D#S#=#(#5#,#4#,#4#,#2#,#1#)#.#################I#########
#########H###################

#############`##################################################################
#########################

##############

`##

##################################`#######*#########
################################V###

###############

#####################1###############

###################

###C##############a###########6################################f###D#e#f#i#n
#i#t#i#o#n#:# ##A# #c#o#v#e#r# #i#s# #a# #s#e#t# #o#f# #d#i#s#j#o#i#n#t# #D#S#
#o#f# ## #t#h#a#t# #c#o#v#e#r#s# #o#r# #c#o#n#t#a#i#n#s# #a#l#l#
#e#l#e#m#e#n#t#s# #o#f# ##.# #T#h#e# #s#i#z#e# #o#f# #t#h#e# #c#o#v#e#r# #c#
#e#q#u#a#l#s# #t#h#e# #n#u#m#b#e#r# #o#f# #D#S# #i#n# #t#h#e# #c#o#v#e#r#.#
#E#x#a#m#p#l#e#:# ##=#(#5#,#3#,#4#,#9#,#6#,#2#,#1#,#8#,#7#)# #C#o#v#e#r#:#{#
#(#5#,#3#,#2#,#1#)#,#(#4#)#,#(#9#,#6#)#,#(#8#,#7#)#}#.# #C#=###o#f# #D#S#=#4#.#
#D#e#f#i#n#i#t#i#o#n#:# ##A# #s#m#a#l#l#e#s#t# #c#o#v#e#r# #(#S#C#)# #i#s# #a#
#c#o#v#e#r# #w#i#t#h# #a# #m#i#n#i#m#u#m# #v#a#l#u#e# #o#f# #c#.#####F###
##################\#########<###################

#############`###################################################F##############
###################################C############################################
##########

`##

######################################################################$#########
#######################0###

###############
##################
###=##############b###########7#####################/###Determine LIS
and SC simultaneously in O(nlogn)######0###############b#####&#
#########&###########&###########&###########&###########&###########&#######b##
#####&######

###

&######

###

&######

###

&######

###

&####2###########
###"###############
#######################################L#e#m#m#a#:# ##I#f# #I# #i#s#
#a#n# #I#S# #o#f# ## #w#i#t#h# #l#e#n#g#t#h# #e#q#u#a#l# #t#o# #t#h#e#
#s#i#z#e# #o#f# #a# #c#o#v#e#r# #C# #o#f# ##,# #t#h#e#n# #I# #i#s# #a# #L#I#S#
#o#f# ## #a#n#d# #C# #i#s# #t#h#e# #s#m#a#l#l#e#s#t# #c#o#v#e#r# #o#f#
#s#i#z#e# #c#.# #
##############################################################`##############
#################################<##################################

`##

########################
##############################################################0################
###
###M###############
###4##############c###########8#########################Proof##############
T###I#f# #I# #i#s# #a#n# #i#n#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#,# #i#t#
#c#a#n#n#o#t# #c#o#n#t#a#i#n# #m#o#r#e# #t#h#a#n# #o#n#e# #e#l#e#m#e#n#t#
#f#r#o#m# #a# #d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#.# ##T#h#i#s# #m#e#a#n#s#
#t#h#a#t# #n#o# #i#n#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e# #c#a#n# #h#a#v#e#
#s#i#z#e# #m#o#r#e# #t#h#a#n# #t#h#e# #s#i#z#e# #o#f# #a#n#y# #c#o#v#e#r# #C#,#
#t#h#a#t# #i#s#,# #i#f# ## # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # ## # # # # #a# #m#a#x#i#m#u#m# #o#f# #o#n#e#
#e#l#e#m#e#n#t# #f#r#o#m# #e#a#c#h# #c#a#n# #p#a#r#t#i#c#i#p#a#t#e# #i#n#
#a#n#y# #i#n#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#.# ##T#h#u#s#,# #a#n# #I#S#
#d#e#r#i#v#e#d# #f#r#o#m# #t#h#i#s# #d#e#c#o#m#p#o#s#i#t#i#o#n# #c#a#n#
#h#a#v#e# #a# #m#a#x#i#m#u#m# #l#e#n#g#t#h# #o#f# #|#C# #|#=#c#.#
#C#o#n#v#e#r#s#e#l#y#,# #C# #m#u#s#t# #b#e# #t#h#e# #s#m#a#l#l#e#s#t#.# #I#f#
#n#o#t#,# #l#e#t# #c## #b#e# #t#h#e# #l#e#n#g#t#h# #o#f# #a# #c#o#v#e#r# #C##
#s#u#c#h# #t#h#a#t# #|#C## |#=#<# #c# # #i#.#e#.#,# #i#f# #w#e# #d#e#r#i#v#e#
#I#S# #f#r#o#m# #C#,# #i#t# #m#u#s#t# #c#o#n#t#a#i#n# #m#o#r#e# #t#h#a#n#
#o#n#e# #e#l#e#m#e#n#t# #f#r#o#m# #o#n#e# #o#f# #t#h#e# #d#e#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e# #o#f# #C## ,# #w#h#i#c#h# #i#s# #n#o#t# #p#o#s#s#i#b#l#e#.# #
#H#e#n#c#e# #C# #h#a#s# #t#o# #b#e# #o#f# #s#m#a#l#l#e#s#t# #s#i#z#e#.#
####6############Z#~###########Z#`#########Z#######################_##########
#####b#########X#######################################

b##

######)#################b#########O#################b#########
#### ###
####### ### ##>#### ### ####### ### ####### ### ####### ### ####### ### #######
### ##"#### ###
#######$b##$###########$b##$###########(###(#######(###(#######(###(#######(###(
#######(###(#######(###(#######(###(#######,b##,######
####0###0#######0###0#######0###0#######0###0##M####0###0#######0###0#######0###
0#######0###0#######0###0#######0###0#######0###0########d###############
###f###############
###)###############
###O###############
##################
###/###############
#################d###########9#########################Construction of
a cover#################G#r#e#e#d#y# #a#l#g#o#r#i#t#h#m# #t#o# #d#e#r#i#v#e#
#a# #c#o#v#e#r#:##S#t#a#r#t#i#n#g# #f#r#o#m# #t#h#e# #l#e#f#t# #o#f# ##,#
#e#x#a#m#i#n#e# #e#a#c#h# #s#u#c#c#e#s#s#i#v#e# #n#u#m#b#e#r# #i#n# ##.# #
#A#p#p#e#n#d# #t#h#e# #c#u#r#r#e#n#t# #n#u#m#b#e#r# #a#t# #t#h#e# #l#e#f#t##m#o#s#t# #s#u#b#s#e#q#u#e#n#c#e# #d#e#r#i#v#e#d# #s#o# #f#a#r# #i#f# #i#t#
#i#s# #p#o#s#s#i#b#l#e# #d#o# #t#h#a#t# #m#a#i#n#t#a#i#n#i#n#g# #t#h#e#
#d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e# #p#r#o#p#e#r#t#y#.# ##I#f# #n#o#t#
#s#t#a#r#t# #a# #n#e#w# #d#e#c#r#e#a#s#i#n#g# #s#u#b#s#e#q#u#e#n#c#e#
#b#e#g#i#n#n#i#n#g# #w#i#t#h# #t#h#e# #c#u#r#r#e#n#t# #e#l#e#m#e#n#t#.# #
#P#r#o#c#e#e#d# #u#n#t#i#l# ## #i#s# #e#x#h#a#u#s#t#e#d#.#######$#########?
###############`#################################`############

###

B###############`######################`#######N#### ###
#####$`##$#########(###(###d########### ###################
###S###############
##################
###N###############
##################e###########:#########################Example#############
#0####=#(#5#,#3#,#4#,#9#,#6#,#2#,#1#,#8#,#7#,#1#0#)#
#D#1#=#(#5#,#3#,#2#,#1#)#,# #D#2#=#(#4#)#,# #D#3#=#(#9#,#6#)#,#
#D#4#=#(#8#,#7#)#,# #D#4#=#(#1#0#)##T#h#e# #a#l#g#o#r#i#t#h#m# #h#a#s# #O#
#(#n#2#)# #c#o#m#p#l#e#x#i#t#y#.# #W#e# #w#i#l#l# #p#r#e#s#e#n#t# #a#n# #O#
#(#n# #l#o#g#n#)# #a#l#g#o#r#i#t#h#m#.##################################

################################################################################
###############################################L#########################
###############################################################

###############################
##############g###########;#####################1###An Efficient Algorithm
for Constructing the Cover#######2#########2#######&###############@###W#e#
#u#s#e# #a# #d#a#t#a# #s#t#r#u#c#t#u#r#e# #w#h#i#c#h# #i#s# #a# #l#i#s#t#
#c#o#n#t#a#i#n#i#n#g# #t#h#e# #l#a#s#t# #n#u#m#b#e#r# #o#f# #e#a#c#h# #o#f#
#t#h#e# #d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e# #t#h#a#t# #i#s# #b#e#i#n#g#
#c#o#n#s#t#r#u#c#t#e#d#.# ##T#h#e# #l#i#s#t# #i#s# #a#l#w#a#y#s# #s#o#r#t#e#d#
#i#n# #i#n#c#r#e#a#s#i#n#g# #o#r#d#e#r#.# #A#n# #i#d#e#n#t#i#f#i#e#r#
#i#n#d#i#c#a#t#i#n#g# #w#h#i#c#h# #l#i#s#t# #t#h#e# #n#u#m#b#e#r#
#b#e#l#o#n#g#s# #t#o# #a#l#s#o# #i#n#c#l#u#d#e#d#.##P#r#o#c#e#d#u#r#e#
#D#e#c#r#e#a#s#i#n#g# #S#e#q#u#e#n#c#e# #C#o#v#e#r##I#n#p#u#t#:# ##=# # # # # #
# # # # # # # # # # # # # # # # # # # #,# #t#h#e# #l#i#s#t# #o#f# #i#n#p#u#t#
#n#u#m#b#e#r#s#.##O#u#t#p#u#t#:# #t#h#e# #s#e#t# #o#f# #d#e#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e#s# #D#i# # #c#o#n#s#t#i#t#u#t#i#n#g# #t#h#e#
#c#o#v#e#r#.###############################b#########D################

b##

######^#################b###########################b#########C#### ### #######


### ####### ### ####### ### ####### ### #####j##################
###D###############
###^###############
###################
###C################################h###########<#########################O(n
logn) Algorithm###F#################################################
#####`####################8#######################################
#######
#########################4###I#n#i#t#i#a#l#i#z#e#:# # #i#!1#;# #
#D#i#=#(#x#1#)#;# # #L#=#(#x#1#,# #i#)# #;# #j#!1#;##F#o#r# #i#=#2# #t#o# #n#
#d#o##S#e#a#r#c#h# #t#h#e# #x#-#f#i#e#l#d#s# #o#f# #L# #t#o# #f#i#n#d# #t#h#e#
#f#i#r#s#t# #x#-#v#a#l#u#e# #s#u#c#h# #t#h#a#t# ## # # # #x#i# #<# #x#.# # #
#& .#t#a#k#e#s# #O#(# #l#o#g#n#)# #t#i#m#e#.##I#f# #s#u#c#h# #a# #v#a#l#u#e#
#e#x#i#s#t#s#,# #t#h#e#n# #i#n#s#e#r#t# #x# #a#t# #t#h#e# #e#n#d# #i#n# #t#h#e#
#l#i#s#t# #D#i# #a#n#d# #s#e#t# #x#i#!x# #i#n# #L#& #T#h#i#s# #s#t#e#p#
#t#a#k#e#s# #c#o#n#s#t#a#n#t# # # #t#i#m#e#.##I#f# #s#u#c#h# #a# #v#a#l#u#e#
#d#o#e#s# #n#o#t# #e#x#i#s#t# #i#n# #L#,# #t#h#e#n# #s#e#t# #j#!j#+#1#.#
#i#n#s#e#r#t# #i#n# #L# #a# #n#e#w# # #e#l#e#m#e#n#t# #(#x#,#j#)# #a#n#d# #
#s#t#a#r#t# #a# #n#e#w# #d#e#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e# #D#j#=#(#x#)#
#E#n#d####P###>#########P#>#########P#%###########P##########P#############P#
################################################################################
################################################################################
################################################################################
###########################
#############################b###############b##############

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

##,####

###

#######

###

#######

###

#######

###

##

####

###

#######

###

#######

###

#######

###

#######

###

#######

###

##

####

###

#######

###

#######

###

##

####

###

##*####

###

#######

###

#######

###

#######

###

#######

###

#######

###

######

###

#######

###

#######

###

#######

###

##'####

###

#######

###

#######

###

#######

###

#######

###

########b#############################################f###############
#####################E#################
#################y#################'#################################
##################i###########=###################################Lemma: At
any point in the execution of the algorithm the list L is sorted in increasing
order with respect to x-values as well as with respect to identifier value.In
fact two separate lists will be better from practical implementation point of
view.Theorem: The greedy cover can be constructed taking O(nlogn) time. A
longest increasing sequence and a smallest cover thus can be constructed using
O(nlogn)
time.###>######################a##################################b#########8
#######################/#######################5###########`################

b##

######+#########################################################################
##X#############################################################################
#############T################### ##################
###+#################Y################################j###########>###########
##########D###E#x#a#m#p#l#e#:# #
##=#(#5#,#3#,#4#,#9#,#6#,#2#,#1#,#8#,#7#,#1#0#)###############
####################k###########?#####################'###Reduction of LIS
problem to LCS problem###@###(#########
#######&###########&#########&###########&#########&###################Definit
ion: Given sequences S1 and S2, let ri be the number of occurrence of the ith
character of S1 in S2.
(position index in sequence S2: ) 1
2 3 4 5 6 Example:S1=a b a c x and S2= b a a b c a Then, r(1)=3, r(2)=2,
r(3)=3, r(4)=1, r(5)=0 .###############a####################

#############`##################################################################
#$#####################################################################
####

`##

##############
#####`#####################################b############## ###
####### ### #####$`##$#########(###(#####(###(#####(###(
####(###(#####(###(#####(###(#####(###(
####(###(#####(###(#####(###(#####(###(#####(###(#####(###(#####(###(#####(###(#
####(###(#####(###(#####(###(#####(###(######

###############
#####################%######################### #######
########### #######
###################
###################
###f##############l###########@###################################D#e#f#i#n
#i#t#i#o#n#:# ##f#o#r# #e#a#c#h# #d#i#s#t#i#n#c#t# #c#h#a#r#a#c#t#e#r# #x# #i#n#
#S#1#,# #d#e#f#i#n#e# #l#i#s#t#(#x#)# #t#o# #b#e# #t#h#e# #p#o#s#i#t#i#o#n#s#
#o#f# #x# #i#n# #S#2# #i#n# #d#e#c#r#e#a#s#i#n#g# #o#r#d#e#r#.##
#E#x#a#m#p#l#e#:# # # #l#i#s#t#(#a#)#=# #(#6#,#3#,#2#)#;# # #
#l#i#s#t#(#b#)#=#(#4#,#1#)#,# # # #l#i#s#t#(#c#)#=#(#5#)#,# #l#i#s#t#(#x#)#=##
#(#e#m#p#t#y# #s#e#q#u#e#n#c#e#)#.####x############h#########Z#########

#############`##################################################################
######################################################################

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

#####

###

###v###

###############
###,#################B##########################################################
############################m###########A################################|
###D#e#f#i#n#i#t#i#o#n#:# #L#e#t# ## #(#S#1#,#S#2#)# #b#e# #a#
#s#e#q#u#e#n#c#e# #o#b#t#a#i#n#e#d# #b#y# #c#o#n#c#a#t#e#n#a#t#i#n#g#
#l#i#s#t#(#s#i#)# #f#o#r# #i#=#1#,#2#,#& ,#n# #w#h#e#r#e# #n# #i#s# #t#h#e#
#l#e#n#g#t#h# #o#f# #S#1# #a#n#d# #s#i# #i#s# #t#h#e# #i#t#h# #s#y#m#b#o#l#
#o#f# #S#1#.# ##E#x#a#m#p#l#e#:# ## #(#S#1#,#S#2#)#=#
#(#6#,#3#,#2#,#4#,#1#,#6#,#3#,#2#,#5#)#.##################################*##
################################################################################
#######################################################################

##############################################>###B#################0##########
#########################9##############n###########B########################
###########T#h#e#o#r#e#m#:# ##E#v#e#r#y# #i#n#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e# #I# #o#f# ## #(#S#1#,#S#2#)# #s#p#e#c#i#f#i#e#s# #a#n#
#e#q#u#a#l# #l#e#n#g#t#h# #c#o#m#m#o#n# #s#u#b#s#e#q#u#e#n#c#e# #o#f# # #S#1#
#a#n#d# #S#2# #a#n#d# #v#i#c#e# #v#e#r#s#a#.# #T#h#u#s# #a# #l#o#n#g#e#s#t#
#c#o#m#m#o#n# #s#u#b#s#e#q#u#e#n#c#e# #L#C#S# # #o#f# #S#1# #a#n#d# #S#2#
#c#o#r#r#e#s#p#o#n#d#s# #t#o# #a# #l#o#n#g#e#s#t# #i#n#c#r#e#a#s#i#n#g#
#s#e#q#u#e#n#c#e# #o#f# ## #(#S#1#,#S#2#)#.##E#x#a#m#p#l#e#:# ##
#(#S#1#,#S#2#)#=# #(#6#,#3#,#2#,#4#,#1#,#6#,#3#,#2#,#5#)#.# #T#h#e#
#p#o#s#s#i#b#l#e# #l#o#n#g#e#s#t# #i#n#c#r#e#a#s#i#n#g# #s#e#q#u#e#n#c#e#s#
#u#s#e#d# #a#s# #i#n#d#i#c#e#s# #t#o# #a#c#c#e#s#s# #t#h#e#
#c#h#a#r#a#c#t#e#r#s# #i#n# #S#2# #y#i#e#l#d# #t#h#e# #L#C#S# #a#s#:#
#(#1#,#2#,#5#)#=# #b# #a# #c#,# # # #(#2#,#3#,#5#)#=#a# #a# #c#,# #
#(#3#,#4#,#6#)#=# #a# #b# #a# #f#o#r# #S#1#=#a# #b# #a# #c# #x# #a#n#d# #S#2#=#
#b# #a# #a# #b# #c# #a#.####T###
###########################
###############b#########################################################3######
#########################################4######################################
#################################5###################################

####

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

#######

###

##Y####

###

#######

###

#######

###

#######

###

######

###

#######

###

##

####

###

#######

###

##

####

###

#######

###

#######

###

#######

###

#######

###

##
####

###

#######

###

#######

###

#######

###

######

###

#########

###############

####################P#####

##########################p######(##### ######################
####################
########
####N### #######I##y###
###y#################################
###################.###################
#I###n#####################*#########################################
#######################a#0#0#a#a##############
########
####N#########PI##y###
###y#################################
################2
#.#####################I###
p#####################*###########################################
#######################a#0#0#a#a########
#####
########
####T#########i##y###
###y##################################
#### ##############q#######################
#I###
n#####################*#########################################
#######################a#0#0#a#a########

#####
########
####T############y###
###y##################################
#### ##############q#2
######################I###
p#####################*###########################################
#######################a#0#0#a#a########H#####
########

####0##############o##~############# ###?########
##############33########8######0##########_#_#_#P#P#T#1#0#####
#####.####g#o##r##############E#########.###?
##y#############C###########################################################
#############
###
#######

###
#######################

###############
############.####+,D####.####+,p###,#############################
###########################
######
#############################################

###

####################On-screen Show###########ns#################################################
#############################################Arial# ###Garamond#####Times New
Roman#
###Wingdings#####SimSun#####Edge#####Microsoft Equation 3.0#####Longest Common
Subsequence#

###LCS Theorem#####Slide 3#####Slide 4#2###Direct Computation of LCS by Dynamic


Programming#3###Example 3: Edit Distance
= 6 + 8 2*5 = 4 #####A Faster
Algorithm for LCS#####Slide 8#####Slide 9#0###Determine LIS and SC
simultaneously in O(nlogn)#####Proof#####Construction of a
cover#####Example#2###An Efficient Algorithm for Constructing the Cover#####O(n
logn) Algorithm# ###Slide 16#$###Example:
=(5,3,4,9,6,2,1,8,7,10)#(###Reduction of LIS problem to LCS problem# ###Slide
19#
###Slide 20#
###Slide 21#

###############Fonts Us

You might also like