type
TIntArr= array of word;
procedure MyQSort(var arr: TIntArr; low: word; high: word); //word可以改为自己需要的类型
var
i, j , x, k : word;
begin
if low < high then
begin
i:= low;
j:= high + 1;
while True do
begin
repeat
Inc(i);
until ((arr[low] <= arr[i])or(i = high));
repeat
Dec(j);
until ((arr[low] >= arr[j])or(j = low));
if i<j then
begin
x:= arr[j];
arr[j]:= arr[i];
arr[i]:= x;
end
else
Break;
end;
x:= arr[j];
arr[j]:= arr[low];
arr[low]:=x;
if(j>1)then
MyQSort(arr, low, j-1);
if(high-j-1 > 1) then
MyQSort(arr, j+1, high);
end;
end;