Similarity(X,Y):
For i = 0,...,m: SIM[i,0] = ig
For j = 1,...,n: SIM[0,j] = jg
For i = 1,...,m:
For j = 1,...,n:
SIM[i,j] = max(
SIM[i-1,j-1] + s(X[i],Y[j]),
SIM[i-1,j]+g,
SIM[i,j-1]+g
)
EndFor
EndFor
Return SIM[m,n]
wesam.teto.9
0
Newbie Poster
Recommended Answers
Jump to PostWell, it could be something like
def Similarity(X,Y): for i in range(m+1): SIM[i,0] = ig for j in range(1, n+1): SIM[0,j] = jg for i in range(1, m+1): for j in range(1, n+1): SIM[i,j] = max( SIM[i-1,j-1] + s(X[i],Y[j]), SIM[i-1,j]+g, SIM[i,j-1]+g ) return SIM[m,n]
but we don't know …
All 2 Replies
wesam.teto.9
0
Newbie Poster
Gribouillis
1,391
Programming Explorer
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.