![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
破晓aa
这个作者很懒,什么都没留下…
展开
-
归并排序
将两个的有序数列合并成一个有序数列,我们称之为"归并"。 归并排序(Merge Sort)就是利用归并思想对数列进行排序。根据具体的实现,归并排序包括"从上往下"和"从下往上"2种方式。 1. 从下往上的归并排序:将待排序的数列分成若干个长度为1的子数列,然后将这些数列两两合并;得到若干个长度为2的有序数列,再将这些数列两两合并;得到若干个长度为4的有序数列,再将它们两两合并;直接合并转载 2018-02-03 19:09:27 · 139 阅读 · 0 评论 -
快速排序
虽然C++中有sort可以用来排序,不过快排还是要会的;#include <iostream> #include <cstdio> using namespace std; void Qsort(int a[], int low, int high) { if(low >= high) return ; int i, j, k; i = low; j ...原创 2018-06-30 22:40:52 · 96 阅读 · 0 评论 -
堆排序
#include <iostream> #include <cstdio> #include <cstring> #define fuck cout << "wtf???\n" using namespace std; int n, m; int heap[50]; void heap_adjust(int x) //这是...原创 2018-11-21 19:38:18 · 151 阅读 · 0 评论