摘要: #include <iostream>using namespace std;void bubbleSort(int a[],int n){ bool flag = true; for (int i = n - 1; flag && i > 0; i--) { flag = false; for (int j = 0; j < i; j++) { if (a[j] > a[j + 1]) { int temp = a[j]; a[j... 阅读全文
posted @ 2013-01-10 17:55 rookieeeeee 阅读(233) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;void insertSort(int a[], int n) { for (int i = 1; i < n; i++) { int temp = a[i]; int j = i - 1; for (; j >= 0 && a[j] > temp; j--) { a[j + 1] = a[j]; } a[j + 1] = temp; }// for (int i = 1; i < n... 阅读全文
posted @ 2013-01-10 03:16 rookieeeeee 阅读(164) 评论(0) 推荐(0) 编辑