Longest increasing subsequence: Difference between revisions

Added Arturo implementation
m (→‎{{header|Phix}}: added syntax colouring, marked p2js compatible)
(Added Arturo implementation)
Line 255:
{{output}}
<lang applescript>{{finds:{{2, 4, 5}}}, {finds:{{0, 2, 6, 9, 11, 15}}}, {finds:{{9, 10, 11}, {3, 8, 9}, {3, 6, 7}, {3, 4, 5}}}, {finds:{{4, 5, 6}}}, {finds:{{5}, {5}}}}</lang>
 
=={{header|Arturo}}==
 
<lang rebol>lis: function [d][
l: new [[]]
loop d 'num [
x: []
loop l 'seq [
if positive? size seq [
if and? num > last seq
(size seq) > size x ->
x: seq
]
]
'l ++ @[x ++ @[num]]
]
result: []
loop l 'x [
if (size x) > size result ->
result: x
]
return result
]
 
loop [
[3 2 6 4 5 1]
[0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15]
] 'seq [
print ["LIS of" seq "=>" lis seq]
]</lang>
 
{{out}}
 
<pre>LIS of [3 2 6 4 5 1] => [3 4 5]
LIS of [0 8 4 12 2 10 6 14 1 9 5 13 3 11 7 15] => [0 4 6 9 13 15]</pre>
 
=={{header|AutoHotkey}}==
1,532

edits