二分法排序
Var
a:array[0..maxint]of longint;
Procedure qs(lx,rx:longint);
Var
i,j,t,x:longint;
Begin
i:=lx; j:=rx; x:=a[(j+i) div 2];
Repeat
While a[i]<x do inc(i);
While a[j]>x do dec(j);
If i<=j then
Begin
t:=a[i]; a[i]:=a[j]; a[j]:=t;
inc(i); dec(j)
End
Until i>j;
If lx<j then qs(lx,j);
If i<rx then qs(i,rx)
End;
Begin
randomize;
For a[0]:=1 to 100 do
a[a[0]]:=random(1000)+1;
qs(1,100);
For a[0]:=1 to 100 do
writeln(a[a[0]])
End.