Shortest common supersequence: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 249: | Line 249: | ||
for n = 1 to len(str3) |
for n = 1 to len(str3) |
||
for m = n to len(str2)-1 |
for m = n to len(str2)-1 |
||
pos = find(str3, str2[m]) |
|||
if pos > 0 and str2[m+1] != str3[pos+1] |
|||
insert(str3, pos, str2[m+1]) |
|||
ok |
|||
next |
next |
||
next |
next |
||
Line 258: | Line 258: | ||
func showarray(vect) |
func showarray(vect) |
||
svect = "" |
|||
for n = 1 to len(vect) |
|||
svect = svect + vect[n] |
|||
next |
|||
see svect |
|||
</lang> |
</lang> |
||
Output: |
Output: |