![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
charles666_zq
这个作者很懒,什么都没留下…
展开
-
快排
#include <iostream>#include <vector>#include <algorithm>using namespace std;void shuffle(vector<int> &nums){ int n = nums.size(); for (int i = 0; i < n; i++) { swap(nums[i], nums[rand() % (n - i) + i]); } return原创 2020-09-13 00:39:19 · 99 阅读 · 0 评论 -
归并排序
#include <iostream>using namespace std;void merge(int a[], int lo, int mid, int hi){ int* b = new int[mid - lo]; for (int i = 0; i < mid - lo; ++i) b[i] = a[lo + i]; for (int i = lo,j = 0, k = mid; i < hi; ++i) { if (k > hi - 1 || (原创 2020-10-09 10:24:57 · 68 阅读 · 0 评论