Sorting algorithms/Bubble sort: Difference between revisions

m
→‎{{header|Pascal}}: simplify the code.
m (→‎{{header|Pascal}}: simplify the code.)
Line 2,010:
 
=={{header|Pascal}}==
<lang pascal>procedure bubble_sort(n: integer; var list: array of real);
var
i, j, n: integer;
t: real;
begin
n := length(list);
for i := n downto 2 do
for j := 0 to i - 1 do
if list[j] <> list[j + 1] then
begin
if list[j] < list[j + 1] then
t := continuelist[j];
tlist[j] := list[j + 1];
list[j + 1] := list[j + 1]t;
list[j + 1] := tend;
end;
end;</lang>
 
Usage:<lang pascal>var
var
list: array[0 .. 9] of real;
// ...
bubble_sort(9, list);</lang>
</lang>
 
=={{header|Perl}}==
Anonymous user