随笔分类 - 0x05 排序
1.离散化
2.中位数(货仓选址)
3.第k大数(快速排序O(n))
4.逆序对(归并)
归并排序、逆序对
摘要:归并排序O(nlong) 1 #include<bits/stdc++.h> 2 #define N 100010 3 using namespace std; 4 5 int n; 6 int a[N],tmp[N]; 7 void merge_sort(int l,int r) { 8 if(l
阅读全文
快速排序,第k小数
摘要:快速排序O(nlong) 1 #include<bits/stdc++.h> 2 #define N 100010 3 using namespace std; 4 5 int n; 6 int a[N]; 7 void qsort(int l,int r) { 8 if(l>=r) return;
阅读全文