Einzelnen Beitrag anzeigen

kaschte

Registriert seit: 2. Apr 2006
72 Beiträge
 
#17

Re: Höchster Wert aus Registry

  Alt 17. Jun 2007, 13:35
Delphi-Quellcode:
procedure Quick_Sort(var A: array of Integer);

 procedure QuickSort(var A: array of Integer; iLo, iHi: Integer);
 var
   Lo, Hi, Mid, T: Integer;
 begin
   Lo := iLo;
   Hi := iHi;
   Mid := A[(Lo + Hi) div 2];
   repeat
     while A[Lo] < Mid do Inc(Lo);
     while A[Hi] > Mid do Dec(Hi);
     if Lo <= Hi then
     begin
       T := A[Lo];
       A[Lo] := A[Hi];
       A[Hi] := T;
       Inc(Lo);
       Dec(Hi);
     end;
   until Lo > Hi;
   if Hi > iLo then QuickSort(A, iLo, Hi);
   if Lo < iHi then QuickSort(A, Lo, iHi);
 end;

begin
 QuickSort(A, Low(A), High(A));
end;
Das ist der Sortierungscode und mit dem hier ruf ich ihn auf. Arrayname ist MyIntArray:

Delphi-Quellcode:
   for I:=Low(MyIntArray) to High(MyIntArray) do
   MyIntArray[I]:=Random(High(Integer));

 Quick_Sort(MyIntArray);
Welche Reihenfolge wird hier gemacht und wie lese ich den Wert jetzt aus?
  Mit Zitat antworten Zitat