摘要:
冒泡排序是一种交换排序。 交换排序的基本思想是:两两比较待排序记录的关键字,发现两个记录的次序相反时则进行交换,知道没有反序的记录为止。 应用交换排序基本思想的主要排序方法有:冒泡排序和快速排序。 冒泡排序:算法描述省略就了。。。 算法c实现: 1 #include <iostream> 2 using namespace std; 3 4 void bubbleSort(int a[],int n) 5 { 6 int i,j,tmp; 7 int exch = 0; 8 for(i = 0;i < n;i++) 9 {10 exch = 0; //交换标志11 for(j 阅读全文
posted @ 2011-05-19 15:29
elwin
阅读(210)
评论(0)
推荐(0)

浙公网安备 33010602011771号