public class jjhj {
void QuickSort(int[] pDataNum,int left,int right)
{
int i,j;
int iTemp;
i = left;
j = right;
int middle = pDataNum[(left+right)/2];
do{
while(pDataNum[i]<middle && i<right)
i++;
while(pDataNum[j]<middle && j>left)
j--;
if(i<=j)
{
iTemp = pDataNum[i];
pDataNum[i] = pDataNum[j];
pDataNum[j] = iTemp;
i++;
j--;
}
}while(i<=j);//如果两边扫描的下标交错,就停止(完成一次)
if(left<j)
QuickSort(pDataNum,left,j);
if(right>i)
QuickSort(pDataNum,i,right);
for(int k=0;k<right;k++)
System.out.print(pDataNum[k]+" ");
}
public static void main(String[] args) {
int[] a={45,25,87,62,15,45,65,87,62,48,39,78};
jjhj ob=new jjhj();
ob.QuickSort(a,0,11);
}
}