摘要: 1.算法原理2.代码实现#include //printArray打印出数组void printArray(int a[],int size){ printf("数组为:[%d] ",a[0]); for (int i=1;ia[j]) { printf("%d%d ",a[... 阅读全文
posted @ 2013-10-24 22:02 赵侠客 阅读(596) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理2.代码实现#include //printArray打印出数组void printArray(int a[],int size){ printf("数组为:[%d] ",a[0]); for (int i=1;ia[i+1]) { ... 阅读全文
posted @ 2013-10-24 21:56 赵侠客 阅读(584) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理2.算法代码#include //printArray打印出数组void printArray(int a[],int size){ printf("数组为:[%d] ",a[0]); for (int i=1;i%d ",a[i-1],a[i]); printA... 阅读全文
posted @ 2013-10-24 21:38 赵侠客 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理2.代码实现#include //printArray打印出数组void printArray(int a[],int size){ printf("数组为:[%d] ",a[0]); for (int i=1;i low) { for (int ... 阅读全文
posted @ 2013-10-24 21:28 赵侠客 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理鸽巢排序是对桶排序算法的改进,只是桶中装对应下标放元素出现的次数待排序数组:a[14] ={ 6, 6, 2, 2, 2, 4, 1, 1, 1, 5, 5, 5, 5, 9 };桶中: bucket[10]=0 3 3 0 1 4 2 0 0 11出次3次,所以bucket[1]=32... 阅读全文
posted @ 2013-10-24 19:50 赵侠客 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理将元素的值放入另一数组下标与其相等的位置 排序前: 6 2 4 1 5 9 桶中:bucket[10]= 0 1 2 0 4 5 6 0 0 9有bucket[6]=6,bucket[2]=2,bucket[4]=4,bucket[1]=1,bucket[5]=5... 阅读全文
posted @ 2013-10-24 19:34 赵侠客 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理2.算法实现#include //printArray打印出数组void printArray(int a[],int size){ printf("数组为:[%d] ",a[0]); for (int i=1;i0;--i) { HeapAdjust(a,i,n)... 阅读全文
posted @ 2013-10-24 18:48 赵侠客 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 1.算法原理找到数组中最小的元素与已好数组的最后一位元素交换位置49 38 65 97 76 13 27 49i=0 最小为13,交换49与13得[13]38 659776[49]27 49i=1 最小为27,交换38与27得13 [27] 65 97 76 49 [38] 49i=2 最小为... 阅读全文
posted @ 2013-10-24 11:22 赵侠客 阅读(170) 评论(0) 推荐(0) 编辑