哪个排序算法是使用微软的STL ::目录::排序()? [英] Which sorting algorithm is used by Microsoft's STL::list::sort()?

查看:129
本文介绍了哪个排序算法是使用微软的STL ::目录::排序()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注:我不小心发布<一个href="http://stackoverflow.com/questions/1717773/which-sorting-algorithm-is-used-by-stls-listsort">this问题没有指明哪些STL实现我所用,我觉得它真的不能被更新,因为它会使大部分答案已经过时了。

所以,正确的问题去 - 这排序算法采用的是低于code,假设我使用微软的Visual C ++?:

的STL库

 列表&LT; INT&GT; mylist中;

// ..insert百万值

mylist.sort();
 

解决方案

只是让你不必依靠二手资料,排序code是正确的列表头 - 这是关于35行。

看来是修改后的迭代(非递归)合并排序多达25箱(我不知道是否有这种变异合并排序的特定名称)。

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).

这篇关于哪个排序算法是使用微软的STL ::目录::排序()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆