javascript-algorithms/src/algorithms/sets/shortest-common-supersequence
Felix Rilling 5734e0a43e Fix typos (#59)
* Fixed typo in the word 'independant'

* Fixed typo in the word 'subsequnce'

* Fixed typo in the word 'icecream'

* Fixed typo in the word 'subsequnce' in shortestCommonSubsequence

* Fixed typo in the word 'depected'

* Fixed typo in the word 'paramaters'
2018-06-12 17:46:40 +03:00
..
2018-04-27 08:19:11 +03:00
2018-04-27 08:19:11 +03:00
2018-06-12 17:46:40 +03:00

Shortest Common Supersequence

The shortest common supersequence (SCS) of two sequences X and Y is the shortest sequence which has X and Y as subsequences.

In other words assume we're given two strings str1 and str2, find the shortest string that has both str1 and str2 as subsequences.

This is a problem closely related to the longest common subsequence problem.

Example

Input:   str1 = "geek",  str2 = "eke"
Output: "geeke"

Input:   str1 = "AGGTAB",  str2 = "GXTXAYB"
Output:  "AGXGTXAYB"

References