zondag 24 juni 2012

Merge Sort

The first programming challenge the course over at Coursera provided us with was to implement an algortihm for counting the inverions in an array. As it turns out, this can be achieved by applying a minor modification in the Merge Sort algorithm. I implemented it both in C++ and Python.
Python version C++ version I'll leave the method to calculate the inversions as an exercise for the reader, it's really not that difficult.

Geen opmerkingen:

Een reactie posten