Content deleted Content added
revert to 8 December; follow talk page protocol |
|||
Line 435:
== standard template library stable_sort() is not always in place merge sort ==
Standard Template Library includes a stable_sort() function, but does not define how it is implemented. In the case of Microsoft's Visual Studio, stable_sort() uses a temp
The ISO C++ standard (1998 and now 2011) does give implementation constraints on how stable_sort should be implemented.
Line 443:
For VS2010, the temporary buffer is 0.5 the size of all the elements as the well-known trick of merge-sorting 2 halves and then merging one half in the temporary buffer with the other remaining half is employed. This cuts down the overhead.
Any algorithm that meets the complexity and stability requirements of ISO C++ can be used but most STLs use a hybrid adaptive mergesort. [[User:Stephen Howe|Stephen Howe]] ([[User talk:Stephen Howe|talk]]) 22:02, 28 January 2012 (UTC)
:VS2005 stable_sort allocates a temporary buffer 0.5 times the size of the data to be sorted, so does VS2010 and VS2015. I suspect all versions of VS stable_sort allocate a half size temporary buffer. stable_partition does allocate a full size temporary buffer. [[User:Rcgldr|Rcgldr]] ([[User talk:Rcgldr|talk]]) 08:23, 15 December 2015 (UTC)
== Implementation code improvements for all sort algorithms ==
|