Pokusavao sam nesto da napravim, ali nisam daleko odmakao..
procedure QuickSort(const AArray : pointer; const AElementSize : Byte; const AElementsCount : Integer);
var
VLeft, VRight : pointer;
pivot : pointer;
tmp : pointer;
begin
VLeft := AArray; VRight := pointer(LongInt(AArray) + AElementSize * (AElementsCount - 1));
GetMem(pivot, AElementSize);
CopyMemory(pivot, pointer(LongInt(VLeft) + AElementSize * (AElementsCount div 2)), AElementSize);
GetMem(tmp, AElementSize);
repeat
CopyMemory(tmp, VLeft, AElementSize);
While Variant(tmp^) < Variant(pivot^) Do
VLeft := pointer(LongInt(VLeft) + AElementSize);
CopyMemory(tmp, VRight, AElementSize);
While Variant(tmp^) > Variant(pivot^) Do
VRight := pointer(LongInt(VRight) - AElementSize);
If LongInt(VLeft) <= LongInt(VRight) Then
Begin
CopyMemory(tmp, VLeft, AElementSize);
CopyMemory(VLeft, VRight, AElementSize);
CopyMemory(VRight, tmp, AElementSize);
VLeft := pointer(LongInt(VLeft) + AElementSize);
VRight := pointer(LongInt(VRight) - AElementSize);
End;
until LongInt(VLeft) > LongInt(VRight);
If LongInt(AArray) < LongInt(VRight) Then QuickSort(AArray, AElementSize, (LongInt(VRight) - LongInt(AArray)) div AElementSize);
If LongInt(VLeft) < LongInt(AArray) + AElementSize * AElementsCount Then QuickSort(VLeft, AElementSize, LongInt(AArray) + AElementSize * AElementsCount);
end;
var
arr : Array[1..10] of Integer;
C1 : Integer;
begin
Randomize;
For C1 := 1 to 10 Do
arr[C1] := Random(10);
QuickSort(@arr[1], SizeOf(Integer), 10);
end.