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 @@
|
|||
Selection: procedure options (main); /* 2 November 2013 */
|
||||
|
||||
declare a(10) fixed binary initial (
|
||||
5, 7, 3, 98, 4, -3, 25, 20, 60, 17);
|
||||
|
||||
put edit (trim(a)) (a, x(1));
|
||||
|
||||
call Selection_Sort (a);
|
||||
|
||||
put skip edit (trim(a)) (a, x(1));
|
||||
|
||||
Selection_sort: procedure (a);
|
||||
declare a(*) fixed binary;
|
||||
declare t fixed binary;
|
||||
declare n fixed binary;
|
||||
declare (i, j, k) fixed binary;
|
||||
|
||||
n = hbound(a,1);
|
||||
do j = 1 to n;
|
||||
k = j; t = a(j);
|
||||
do i = j+1 to n;
|
||||
if t > a(i) then do; t = a(i); k = i; end;
|
||||
end;
|
||||
a(k) = a(j); a(j) = t;
|
||||
end;
|
||||
end Selection_Sort;
|
||||
|
||||
end Selection;
|
||||
Loading…
Add table
Add a link
Reference in a new issue