Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
code ChOut=8, IntOut=11;
|
||||
|
||||
proc GnomeSort(A(0..Size-1)); \Sort array A
|
||||
int A, Size;
|
||||
int I, J, T;
|
||||
[I:= 1;
|
||||
J:= 2;
|
||||
while I < Size do
|
||||
if A(I-1) <= A(I) then
|
||||
[\ for descending sort, use >= for comparison
|
||||
I:= J;
|
||||
J:= J+1;
|
||||
]
|
||||
else
|
||||
[T:= A(I-1); A(I-1):= A(I); A(I):= T; \swap
|
||||
I:= I-1;
|
||||
if I = 0 then
|
||||
[I:= J;
|
||||
J:= J+1;
|
||||
];
|
||||
];
|
||||
];
|
||||
|
||||
int A, I;
|
||||
[A:= [3, 1, 4, 1, -5, 9, 2, 6, 5, 4];
|
||||
GnomeSort(A, 10);
|
||||
for I:= 0 to 10-1 do [IntOut(0, A(I)); ChOut(0, ^ )];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue