Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -0,0 +1,29 @@
|
|||
int A, Len;
|
||||
|
||||
func IsSorted;
|
||||
int I;
|
||||
[for I:= 0 to Len-2 do
|
||||
if A(I) > A(I+1) then return false;
|
||||
return true;
|
||||
];
|
||||
|
||||
func PermSort(Last);
|
||||
int Last;
|
||||
int I, T;
|
||||
[if Last <= 0 then return IsSorted;
|
||||
for I:= 0 to Last do
|
||||
[T:= A(I); A(I):= A(Last); A(Last):= T;
|
||||
if PermSort(Last-1) then return true;
|
||||
T:= A(I); A(I):= A(Last); A(Last):= T;
|
||||
];
|
||||
return false;
|
||||
];
|
||||
|
||||
int I;
|
||||
[A:= [170, 45, 75, -90, -802, 24, 2, 66];
|
||||
Len:= 8;
|
||||
PermSort(Len-1);
|
||||
for I:= 0 to Len-1 do
|
||||
[IntOut(0, A(I)); if I < Len-1 then Text(0, ", ")];
|
||||
CrLf(0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue