Le Tri Shell

Le Tri Shell:

Voici un exemple de code source du Tri Shell

Procedure Tri_Shell_Rec (Var t: TAB; n,h : integer);
Var aux,i : integer;
begin
If h > 0 Then
Begin
If n > h Then
begin
Tri_Shell_Rec (t,n - h,h);
If t[n] < t[n - h] Then
Begin
aux:= t[n];
i := n;
Repeat
t[i] := t[i - h];
i := i - h;
Until (i = h) Or (aux > t[i - h]);
t[i] := aux;
End;
End;
Tri_Shell_Rec (t,n,h Div 3);
End;
End;

Taille : 0KØ
Niveau : Intermediaire
Auteur : ----