public int Partition(int[] list, int pFirst =0, int pLast=0)
{
int m_midNum = list[pFirst];
while(pLast > pFirst)
{
for (; pLast > pFirst; pLast--)
{
if (list[pLast] < m_midNum)
{
list[pFirst] = list[pLast];
break;
}
}
for (; pFirst < pLast; pFirst++)
{
if (list[pFirst] > m_midNum)
{
list[pLast] = list[pFirst];
break;
}
}
}
list[pFirst] = m_midNum;
return pFirst;
}
public void Quick_Sort(int[] list, int pFirst, int pLast)
{
if(pFirst < pLast)
{
int midNum = Partition(list, pFirst, pLast);
Quick_Sort(list, pFirst, midNum - 1);
Quick_Sort(list, midNum + 1, pLast);
}
}
各位大佬帮忙看看,如有差错或者冗余请帮忙指正,感谢!