Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
(VBScript version) |
|||
Line 974: | Line 974: | ||
} |
} |
||
}</lang> |
}</lang> |
||
=={{header|PL/I}}== |
|||
<lang PL/I> |
|||
/* A primitive bubble sort */ |
|||
bubble_sort: procedure (A); |
|||
declare A(*) fixed binary; |
|||
declare temp fixed binary; |
|||
declare i fixed binary, no_more_swaps bit (1) aligned; |
|||
do until (no_more_swaps); |
|||
no_more_swaps = true; |
|||
do i = lbound(A,1) to hbound(A,1)-1; |
|||
if A(i) > A(i+1) then |
|||
do; temp = A(i); A(i) = A(i+1); A(i+1) = temp; |
|||
no_more_swaps = false; |
|||
end; |
|||
end; |
|||
end; |
|||
end bubble_sort; |
|||
</lang> |
|||
=={{header|Pop11}}== |
=={{header|Pop11}}== |