2015年12月25日

排序算法(三)——插入排序

摘要: 插入排序算法思想: 将无序序列最左端的元素插入到有序序列中 示例代码: #include <iostream> using namespace std; void swap(int &a,int &b){ int temp=a; a=b; b=temp; return;}void Insert_so 阅读全文

posted @ 2015-12-25 21:44 法杰拉 阅读(178) 评论(0) 推荐(0) 编辑

排序算法(二)——选择排序

摘要: 上篇博客介绍了冒泡算法,接下来介绍插入排序和选择排序. 选择排序; 算法思想:从无序序列中找到最大(或最小)元素,放在序列的最右边(或最左边)。 代码如下: #include <iostream> using namespace std; void swap(int &a,int &b) { int 阅读全文

posted @ 2015-12-25 21:16 法杰拉 阅读(213) 评论(0) 推荐(0) 编辑

导航