1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| procedure tri;
var i,j:integer;
mem1,mem2:pointeur;
begin
p1:=debut;
for i:=1 to compteurmax do (*compteurmax= nbre d'éléments dans la liste chaînée*)
for j:=1 to compteurmax-1 do
begin
if p1^.suivant^.info<p1^.info then
begin
mem1:=p1^.suivant^.suivant;
mem2:=p1^.suivant;
p1^.suivant^.precedent:=p1^.precedent;
p1^.suivant^.suivant^.precedent:=p1;
p1^.suivant^.suivant:=p1;
p1^.precedent^.suivant:=p1^.suivant;
p1^.suivant:=mem1;
p1^.precedent:=mem2;
end;
p1:=p1^.suivant;
end;
end; |
Partager