关于快速排序
快速排序想必大家都知道,快排应该是各种排序算法中最普遍的了,因为它好打并且效率也挺高,平均时间复杂度为 Θ ( n log n ) \Theta(n\log_n) Θ(nlogn),这是基于比较的排序方法时间下限。
相信大多数情况下,大家是这么写快排的:
#include<bits/stdc++.h>
using namespace std;
int n,a[100001];
void qsort(int l,int r)
{
int mid=a[(l+r)/2],i=l,j