哈希排序就是桶排序:https://www.cnblogs.com/helloworld2019/p/10353265.html
快排就能解决问题:
#include#include #include #define N 1000050int a[N];//当数据过大时要放在函数外面防止栈溢出int m;void QuickSort(int low,int high){int k;int i;k=a[low];int left=low;int right=high;if(left>right)return ;while(left!=right){while(a[right] k&&left <=left+1) QuickSort(low,left-1);else{QuickSort(low,left-1);QuickSort(left+1,high);}}int main(){int i;int j;int n;while(scanf("%d%d",&n,&m)!=EOF){for(i=0;i