Shortest common supersequence: Difference between revisions
Content added Content deleted
m (→{{header|Wren}}: Changed to Wren S/H) |
(Added Easylang) |
||
Line 259: | Line 259: | ||
{{out}} |
{{out}} |
||
<pre>abdcabdab</pre> |
<pre>abdcabdab</pre> |
||
=={{header|EasyLang}}== |
|||
{{trans|C++}} |
|||
<syntaxhighlight> |
|||
func$ car x$ . |
|||
return substr x$ 1 1 |
|||
. |
|||
func$ cdr x$ . |
|||
return substr x$ 2 -1 |
|||
. |
|||
func$ scs x$ y$ . |
|||
if x$ = "" |
|||
return y$ |
|||
. |
|||
if y$ = "" |
|||
return x$ |
|||
. |
|||
if car x$ = car y$ |
|||
return car x$ & scs cdr x$ cdr y$ |
|||
. |
|||
r1$ = scs x$ cdr y$ |
|||
r2$ = scs cdr x$ y$ |
|||
if len r1$ <= len r2$ |
|||
return car y$ & r1$ |
|||
else |
|||
return car x$ & r2$ |
|||
. |
|||
. |
|||
print scs "abcbdab" "bdcaba"</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
abdcabdab |
|||
</pre> |
|||
=={{header|Elixir}}== |
=={{header|Elixir}}== |