摘要: 插入排序使用的是增量(incremental)方法;在排好子数组A[1..j-1]后,将A[j]插入,形成排好序的子数组A[1..j]。更多信息请参考:http://baike.baidu.com/view/396887.htmC语言代码: 1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <memory.h> 4 #include <time.h> 5 6 void init(int *array, int count) 7 { 8 int n = 0; 9 srand((unsigne 阅读全文
posted @ 2012-12-24 22:39 Yuan Ping 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 每一趟从待排序的数据元素中选出最小(或最大)的一个元素,顺序放在已排好序的数列的最后,直到全部待排序的数据元素排完。 选择排序是不稳定的排序方法。更多信息请参考:http://baike.baidu.com/view/547263.htmC语言代码: 1 #include <stdlib.h> 2 #include <stdio.h> 3 #include <memory.h> 4 #include <time.h> 5 6 void init(int *array, int count) 7 { 8 int n = 0; 9 srand((un 阅读全文
posted @ 2012-12-24 22:37 Yuan Ping 阅读(190) 评论(0) 推荐(0) 编辑