public int[] BubbleSort(int[] list)
{
int m_lenth = list.Length;
int m_sortedNum;
int m_perfectNum = 0;
for (int m_chaosList = m_lenth; m_chaosList > 1; m_chaosList--)//趟,每一趟m_chaosList无序区都少一个数
{
for(int m_no = 0; m_no < m_chaosList - 1; m_no++)//每一趟的对比
{
if(list[m_no] > list[m_no + 1])
{
m_sortedNum = list[m_no + 1];
list[m_no + 1] = list[m_no];
list[m_no] = m_sortedNum;
}
else
{
m_perfectNum += 1;
}
if(m_perfectNum == m_chaosList)
{
break;
}
}
m_perfectNum = 0;
}
return list;
}