1. We should go over "Counting Inversion" which is section 5.3 of the book. Given a sequence (of unique numbers) $a_1, a_2, \ldots, a_n$ we want to find the number of pairs $i < j$ such that $a_i > a_j$. To solve the problem we simultaneously merge-sort $a_1, a_2, \ldots, a_n$, and count the number of inversions. This is easily done when merging. You should just add the number of numbers left in the first half when you are merging two halves when the number in the front of the second half is being added. The following code does this. (int, list) MergeCount(int from, int to) { if(to == from + 1) return (0, A[from..to]); int mid = (from+to)/2; int res = 0, sub_solution = 0; (sub_solution, A[from..mid]) = MergeCount(from, mid); res += sub_solution; (sub_solution, A[mid..to]) = MergeCount(from, mid); res += sub_solution; int Sol[]; for(int x=from, y=mid;(x T(n)=O(log n).