
09-17-2001, 07:45 AM
|
|
Posts: 1337
|
 |
Join Date: Mar 2001
Location: Staffs, England Quote: "Bomy in Progress" Looks: Amazingly Stunning Popularity: 10,000%
Posts: 1,325
|
|
Quote:
Originally posted by galen
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;
|
Yeah, thanks.......... do you think you could talk to me on ICQ and teach me what the hell that means please? =) |
__________________
------------------------
- UnOfficial Graalian Story Teller
- Holder Of The 1000th Upgraded Graalian Account (Not This One)
------------------------------------------------------------------------------
"The Fairy Princess - Zorro" - A New Beggining
|
|
|
|