Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Procedure QuickSort(FList: PPointerList; L, R : Longint;Compare: TListSortCompare);
- var
- I, J, P: Longint;
- PItem, Q : Pointer;
- begin
- repeat
- I := L;
- J := R;
- P := (L + R) div 2;
- repeat
- PItem := FList^[P];
- while Compare(PItem, FList^[i]) > 0 do
- I := I + 1;
- while Compare(PItem, FList^[J]) < 0 do
- J := J - 1;
- If I <= J then
- begin
- Q := FList^[I];
- Flist^[I] := FList^[J];
- FList^[J] := Q;
- if P = I then
- P := J
- else if P = J then
- P := I;
- I := I + 1;
- J := J - 1;
- end;
- until I > J;
- if L < J then
- QuickSort(FList, L, J, Compare);
- L := I;
- until I >= R;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement