1void run(int* pData,int left,int right)
2{
3 int i,j;
4 int middle,iTemp;
5 i=left;
6 j=right;
7 middle=pData[(left+right)/2];
8 do
9 {
10 while ((pData[i]<middle)&&(i<right)) i++;
11 while ((pData[j]>middle)&&(j>left)) j--;
12 if (i<=j)
13 {
14 iTemp=pData[i];
15 pData[i]=pData[j];
16 pData[j]=iTemp;
17 i++;
18 j--;
19 }
20 }while (i<=j);
21 if (i<right) run (pData,i,right);
22 if (j>left) run (pData,left,j);
23}
24void quicksort(int* pData,int count)
25{
26 run (pData,0,count-1);
27}