all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
count_sort: procedure (A);
|
||||
declare A(*) fixed;
|
||||
declare (min, max) fixed;
|
||||
declare i fixed binary;
|
||||
|
||||
max, min = A(lbound(A,1));
|
||||
do i = 1 to hbound(A,1);
|
||||
if max < A(i) then max = A(i);
|
||||
if min > A(i) then min = A(i);
|
||||
end;
|
||||
|
||||
begin;
|
||||
declare t(min:max) fixed;
|
||||
declare (i, j, k) fixed binary (31);
|
||||
t = 0;
|
||||
do i = 1 to hbound(A,1);
|
||||
j = A(i);
|
||||
t(j) = t(j) + 1;
|
||||
end;
|
||||
k = lbound(A,1);
|
||||
do i = min to max;
|
||||
if t(i) ^= 0 then
|
||||
do j = 1 to t(i);
|
||||
A(k) = i;
|
||||
k = k + 1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end count_sort;
|
||||
Loading…
Add table
Add a link
Reference in a new issue