冒泡排序
1 /// <summary>
2 /// 冒泡排序法
3 /// </summary>
4 /// <param name="sqList">要排序的顺序表</param>
5 public void BubbleSort(SeqList<int> sqList)
6 {
7 int temp = 0;
8 for (int i = 0; i <= sqList.Last; ++i)
9 {
10 for (int j = sqList.Last; j > i; --j)
11 {
12 if (sqList[i] > sqList[j])
13 {
14 temp = sqList[i];
15 sqList[i] = sqList[j];
16 sqList[j] = temp;
17 }
18 }
19 }
20 }
2 /// 冒泡排序法
3 /// </summary>
4 /// <param name="sqList">要排序的顺序表</param>
5 public void BubbleSort(SeqList<int> sqList)
6 {
7 int temp = 0;
8 for (int i = 0; i <= sqList.Last; ++i)
9 {
10 for (int j = sqList.Last; j > i; --j)
11 {
12 if (sqList[i] > sqList[j])
13 {
14 temp = sqList[i];
15 sqList[i] = sqList[j];
16 sqList[j] = temp;
17 }
18 }
19 }
20 }