tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,24 @@
|
|||
define ncsubseq(l);
|
||||
lvars acc = [], gap_started = false, is_continuous = true;
|
||||
define do_it(l1, l2);
|
||||
dlocal gap_started;
|
||||
lvars el, save_is_continuous = is_continuous;
|
||||
if l2 = [] then
|
||||
if not(is_continuous) then
|
||||
cons(l1, acc) -> acc;
|
||||
endif;
|
||||
else
|
||||
front(l2) -> el;
|
||||
back(l2) -> l2;
|
||||
not(gap_started) and is_continuous -> is_continuous;
|
||||
do_it(cons(el, l1), l2);
|
||||
save_is_continuous -> is_continuous;
|
||||
not(l1 = []) or gap_started -> gap_started;
|
||||
do_it(l1, l2);
|
||||
endif;
|
||||
enddefine;
|
||||
do_it([], rev(l));
|
||||
acc;
|
||||
enddefine;
|
||||
|
||||
ncsubseq([1 2 3 4 5]) =>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
[[1 3] [1 4] [2 4] [1 2 4] [1 3 4] [1 5] [2 5] [1 2 5] [3 5] [1 3 5]
|
||||
[2 3 5] [1 2 3 5] [1 4 5] [2 4 5] [1 2 4 5] [1 3 4 5]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue