Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -0,0 +1,38 @@
|
|||
proc ShowLongestSeq(List, ListSize); \Show longest increasing items in List
|
||||
int List, ListSize;
|
||||
int Longest, \number of increasing items found during search
|
||||
Seq(100), \sequence being followed in search
|
||||
LongestSeq(100), \sequence with most increasing items
|
||||
II;
|
||||
|
||||
proc Search(I, Max, L); \Search for sequence of increasing items
|
||||
int I, \index into List
|
||||
Max, \maximum item found
|
||||
L; \number of items during search
|
||||
int J, K;
|
||||
[Seq(L-1):= List(I); \record sequence being examined
|
||||
if L > Longest then \if this is a longer sequence then
|
||||
[Longest:= L;
|
||||
for K:= 0 to L-1 do \ record current Seq in LongestSeq
|
||||
LongestSeq(K):= Seq(K);
|
||||
];
|
||||
for J:= I+1 to ListSize-1 do \continue search for next larger item
|
||||
if List(J) > Max then
|
||||
Search(J, List(J), L+1);
|
||||
];
|
||||
|
||||
[Longest:= 0;
|
||||
Search(0, List(0), 1); \start search at first item
|
||||
for II:= 0 to Longest-1 do \show longest increasing item sequence
|
||||
[IntOut(0, LongestSeq(II)); ChOut(0, ^ )];
|
||||
CrLf(0);
|
||||
];
|
||||
|
||||
int Lists, Sizes, L;
|
||||
[Lists:= [
|
||||
[3, 2, 6, 4, 5, 1],
|
||||
[0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15] ];
|
||||
Sizes:= [6, 16];
|
||||
for L:= 0 to 1 do
|
||||
ShowLongestSeq(Lists(L), Sizes(L));
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue