void BubbleSort(int a[], int n) { int i = 0; int j = 0; int tmp = 0; for (i = 0; i < n - 1; i++) { for (j = i + 1; j < n; j++) { if (a[i] > a[j]) { tmp = a[i]; a[i] = a[j]; a[j] = tmp; } } } }
冒泡排序法,布布扣,bubuko.com
冒泡排序法
原文:http://www.cnblogs.com/LubinLew/p/BubbleSort.html