普林斯顿的算法课质量很赞,这次作业中涉及到一个"逆序数"的知识,正好在之前学习mergesort时有一道课后提供的面试题与之相关,于是试着实现了。
原题链接:http://www.practice.geeksforgeeks.org/problem-page.php?pid=558
Given an array, find inversion count of array.
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maxim