快速排序
快速排序算法:
void Freq::Fastsort(int *arr,int left,int right)
{
int i,j,base,temp;
base = arr[left];
i = left;
j = right;
if(left >= right)
return;
while(i < j)
{
while(i<j && base <= arr[j])
j--;
while(i<j && base >= arr[i])
i++;
if(i<j)
{
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
arr[left] = arr[i];
arr[i] = base;
Fastsort(arr,left,i-1);
Fastsort(arr,i+1,right);
}