Deux méthodes de tri

a guest May 26th, 2019 77 in 39 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. procedure Permuter(var a, b: integer);
  2. var aux: integer;
  3. begin
  4.     aux:=a;a:=b;b:=aux;
  5. end;
  7. procedure Tri1(var t: tab; n: integer);
  8. var i, j : integer;
  9. begin
  10.     for i:=1 to n-1 do
  11.         for j:=1 to n-1 do
  12.             if t[j]>t[j+1] then Permuter(t[j], t[j+1]);
  13. end;
  15. procedure Tri2(var t: tab; n: integer);
  16. var i, j : integer;
  17. begin
  18.     for i:=1 to n-1 do
  19.         for j:=i+1 to n do
  20.             if t[i]>t[j] then Permuter(t[i], t[j]);
  21. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand