here, have a shell sort
NPC Code:
Procedure ShellSort(var List: Group; var cntr, cntr2: Integer);
Var {Sorts the words and replaces them in}
loc,
gap, {the array}
maxNum : Integer;
temp : String[4];
change : Boolean;
Begin
ClrScr;
cntr := 0;
cntr2 := 0;
gap := Trunc(max div 2);
While gap > 0 do
Begin
Repeat
change := false;
For loc := min to max - gap do
Begin
inc(cntr2, 1);
If List[loc] > List[loc + gap]
then Begin
temp := List[loc];
List[loc] := List[loc + gap];
List[loc + gap] := temp;
inc(cntr, 1);
change := true;
End;
End;
Until change = false;
gap := Trunc(gap div 2);
End;
End;