Just curious cire, what's your runtime on 1 million random elements sorted? And what's your processor.
And getting a bit unwieldy for one file? That's not even 300 lines. I'm trying to manage almost double of that.
Note: Running your code from github on my system, I got:
List is sorted.
1796ms sorting the list.
List is sorted.
1437ms sorting the list.
Process returned 0 (0x0) execution time : 9.188 s
Press any key to continue.
On 1 million elements % 5000, that's pretty fast if I may say so myself. I'll have to look into implementing that a bit more. So far, I'm intrigued. Also, is merge sort the bottom up method, like how I did it, and recursive is the top down method, like fun2code is attempting?
Also, would chrono replace the need for my windows function? I hate the windows lib and really want a high resolution timer. I'll have to inspect your code a bit to understand it before implementing it. Or check out the references here at least.
I'm curious cire, what's your background? Do you code for a living? Where did you learn so much?
Edit: The chrono features are awesome, I just really hate the cast. It's extremely long and doesn't look right broken up in any sense. I was able to typedef milliseconds to just ms, but even that doesn't help shorten it up. You also can't declare using std::chrono which I thought was weird. I'm going to have to delve into the features of the library and see what options I have...but then again, I assume you already have and this is either the only way, or the best way already.
Another thing I want to get around to is learning more about the new random libraries. They seem really nifty to all just be grouped in one location. And the thought behind it is incredible. I'm really loving the C++11 features, and I don't care what anyone says, even if they aren't all used on a daily basis, they're fun to play with and even better when you actually need them.
On a curious level, looking over your code, you typedef'd
typedef node* (*sort_func)(node*) ;
That's a function pointer, but isn't that short of old school? Do you just find it easier to use that over functional?
One last thing, since we're on the topic of speed and times, does calling functions increase overhead, even if the function itself is fairly quick? The reason I ask is because my unique function seems like it should be pretty quick, but it is the only thing so far that's slower than STL. What implementation did they use differently than mine?
By the way, I've been looking through you code a bit, I haven't gotten to your sort functions yet, but even though I was expecting some hard to follow code, it's pretty straight forward, even more so than mine. The only thing I have to say though is I'm not a fan on your organization skill of your functions. I try to keep mine in alphabetically grouped sections, but it looks like yours are defined in the order they're used?
Also, why is the top down method, recursive, faster? I figured that splitting it would force it to do more calculations than just working from the bottom up. You've taught me a lot so far, and never cease to amaze me. I'm glad you joined in on this thread.