Tobias Pankrath: > Use std.algorithm.sort with a custom comparison function. It's a very nice example of learning algorithms and data fitting. I have shown an answer very fitted (perhaps over-fitted) on the given example. With just the given data there is no way to know how much general the problem is :-) Bye, bearophile