Note: I accidentally posted this question without specifying which STL implementation I was using, and I felt it can't really be updated since it would render most of its answers obsolete.
So, the correct question goes - which sorting algorithm is used in the below code, assuming I'm using the STL library of Microsoft Visual C++?:
list<int> mylist;
// ..insert a million values
mylist.sort();
Just so you don't have to rely on second hand information, the the sort code is right in the list header - it's about 35 lines.
Appears to be a modified iterative (non-recursive) merge sort with up to 25 bins (I don't know if there's a particular name for this variant of merge sort).
At least in recent versions (e.g. VC++ 9.0/VS 2008) MS VC++ uses a merge-sort.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With