摘要: 快排代码 #include <iostream> #include <cstdio> using namespace std; int a[100005],n; void quick_sort(int l,int r) { int i=l,j=r,flag = a[l+r>>1]; do{ whil 阅读全文
posted @ 2022-04-08 18:14 TCcjx 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 快排的基本思想就是二分,理解了其实就不难,之前看了y总的板子,我觉得洛谷的更容易理解一点。 #include <iostream> using namespace std; int a[110000]; void quick_sort(int a[],int l,int r){ int i=l,j= 阅读全文
posted @ 2022-04-08 15:57 TCcjx 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 1.计数排序 计数排序读入选票并统计的时间复杂度是O(m),输出选票的时间复杂度为O(m+n),空间复杂度为O(n),因此计数排序只能用于排序编号范围不是很大的数字。 #include <iostream> using namespace std; int a[1010],n,m,tmp; int 阅读全文
posted @ 2022-04-08 14:43 TCcjx 阅读(29) 评论(0) 推荐(0) 编辑