Competitive-Programming-and-Contests-VP-Solution

The repository that contains all solutions made for the course Competitive Programming and Contests by the University of Pisa

View the Project on GitHub

Inversion Counting Problem or Another reference

Algorithm Solved Solution Time :clock11:
Merge Sort :heavy_check_mark: Sol 0.15
Fenwick Tree :construction: Sol ?

Solution description

The complete solution use the merge sort to count the number of inversion count, the basic idea the merge sort use the invention technique to sort the array, and in this solution, we count the number of inversions that the merge sort need to sort the array.

The time complexity is O(N log N) and the space complexity is O(N log N) because we need to use the tree to make the remapping of the input.