分治2——求排列的逆序數

最笨的方法時間複雜度爲O(n2),採用 利用二分歸併排序算法思想,時間複雜度爲O(nlogn) #include<iostream> using namespace std; int a[1000], temp[1000]; long long sum = 0; void merge(int a[], int s, int m, int e, int temp[]) { int pb = 0
相關文章
相關標籤/搜索