Metoda bąbelkowa
Metoda bąbelkowa
for j:=n downto 2 do
i:=1 to j-1 do
if a[i] > a[i+1] then
begin
p:=a[i+1];
a[i+1]:= a[i];
a[i]:=p;
end;
Metoda bąbelkowa
for j:=n downto 2 do
i:=1 to j-1 do
if a[i] > a[i+1] then
begin
p:=a[i+1];
a[i+1]:= a[i];
a[i]:=p;
end;