Algorithm Implementation/Sorting/Smoothsort

C++
This implementation of Smoothsort is substantially different (in presentation) from Dijkstra's original one, having undergone some serious refactoring.

In order to keep the code as tidy as possible given the inherent complexity of the algorithm, the helper functions are isolated in an anonymous namespace.

In practice, the three sections below would be concatenated in the given order in a separate source file (say, smoothsort.cpp).

Last but not least, the code uses the long long unsigned type, which is a gcc extension (no, it isn't). On installations where gcc is unavailable, replace with unsigned long (it only affects the maximum size of the arrays which can be sorted).