快速排序


void quickSort(QVector<int>& vct, int low, int high)
{
    if( vct.isEmpty() )
        return;
    if(low < high)
    {
        //基准数据
        int l = low;
        int h = high;
        int tmp = vct[l];
        while(l < h) 
        {
            //当队尾数据大于等于基准数据时,向前挪动h下标,直到小于基准数据,将此时的h数据赋予l
            while(l=tmp)
                h--;
            vct[l] = vct[h];
            //当队首数据小于等于基准数据时,向后挪动l下标,直到大于基准数据,将此时的l数据赋予h
            while(ltmp)
                l++;
            vct[h] = vct[l];
        }        
        //跳出循环,此时l=h,将tmp赋予此位置
        vct[l] = tmp;
        quickSort(vct, low, h-1);
        quickSort(vct, h+1, high);
    }  
}