Merge Sort: Counting Inversions

  • + 21 comments

    Make sure that you use a long to track the swaps! If you use an int, you'll get the wrong answer due to integer overflow in the last third or so of the cases.