[code]package mid.JZ51数组中的逆序对;import java.util.Arrays;public class Solution { /** * 分治 * * @param array * @return */ public int count = 0; public int InversePairs(int[] array) { divMerge(array, 0, array.length-1); return count; } public void divMerge(int[] array, int left, int right) { if (left >= right) return; int mid = left + (right - left) / 2; //分左边 divMerge(array, left, mid); //分右边 divMerge(array, mid + 1, right); //合并 int i = left; int j = mid + 1; //临时数组 int[] tmp = new int[right - left + 1]; int k = 0; while (i