Category : Pascal Source Code
Archive   : USNGTP.ZIP
Filename : LST04-02.PAS

 
Output of file : LST04-02.PAS contained in archive : USNGTP.ZIP
(* Include the following directive if code is being compiled on
an 8 bit CP/M system.
{$A-}
*)
procedure Sort_List(var values: Word_Array; lo, hi: Integer);
var new_lo,
new_hi : Integer; { Used to divide the array of values.}
center_value,
hold_value : Word_Str; { Used when values are swaped.}

begin
if ((hi - lo) > 1) then
begin
center_value := values[(hi + lo) div 2];
new_lo := lo; new_hi := hi;
while (new_lo <= new_hi) do
begin
while(values[new_lo] < center_value) do
new_lo := Succ(new_lo);
while(values[new_hi] > center_value) do
new_hi := Pred(new_hi);
if (new_lo <= new_hi) then
begin
hold_value := values[new_lo];
values[new_lo] := values[new_hi];
values[new_hi] := hold_value;
new_lo := Succ(new_lo);
new_hi := Pred(new_hi);

end; {if}
end; {while}
Sort_List(values,lo,new_hi);
Sort_List(values,new_lo,hi);
end
else
if ((hi - lo) = 1) then
if (values[hi] < values[lo]) then
begin
hold_value := values[hi];
values[hi] := values[lo];
values[lo] := hold_value;
end;
end; { Sort_List }

(* Include the following directive if code is being compiled on
an 8 bit CP/M system.
{$A+}
*)

{ Listing. 4-2 Sort_List procedure using the quicksort
algorithm.
}


  3 Responses to “Category : Pascal Source Code
Archive   : USNGTP.ZIP
Filename : LST04-02.PAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/