mergesort is one of the earlier sorting algorithms. It was developed and characterized by none other than von Neumann. It's a great example of a divide-and-conquer algorithm, and it's quite fun to write in Clojure.
So that's the task: implement mergesort.
You can find descriptions of mergesort by searching. But remember, it's easy in Clojure because recursion is the norm.
Note: Make sure it works on large lists. Try it on a list of 1 million numbers.
- Have it use
compareto work on more than numbers.
- Have it take a key to sort by.
clojure.reducersto implement a parallel version.