STL中list的排序算法
来源:互联网 发布:sql2008数据库备份 编辑:程序博客网 时间:2024/05/16 02:26
转-注:因为非random access的链表不适合做quick sort, 一直怀疑STL的list使用了merge sort. 今天在网上搜了一下,转至此处做个记录。
STL 中的List排序算法(in SGI STL)
SGI STL笔记(list中的sort算法)
template <class T, class Alloc>void list<T, Alloc>::sort() { if (node->next == node || link_type(node->next)->next == node) return; list<T, Alloc> carry; list<T, Alloc> counter[64]; int fill = 0; while (!empty()) { carry.splice(carry.begin(), *this, begin()); int i = 0; while(i < fill && !counter[i].empty()) { counter[i].merge(carry); carry.swap(counter[i++]); } carry.swap(counter[i]); if (i == fill) ++fill; } for (int i = 1; i < fill; ++i) counter[i].merge(counter[i-1]); swap(counter[fill-1]);}
0 0
- STL中list的排序算法
- stl中list的sort算法实现
- stl中list的sort算法实现
- stl的list排序
- STL中排序算法
- STL list中对象排序
- STL list中对象排序
- STL中各种排序算法的区别
- STL中排序算法的选择
- STL 中 算法的遍历和排序
- STL中list链表的sort算法详解
- STL中排序算法介绍
- STL 中的List排序算法(in SGI STL)
- C++中STL List排序实现
- STL中list结构体元素排序
- STL LIST中自定义排序函数例子
- List的排序算法
- STL 中排序和通用的算法( 14 个 )
- 怎么用代码判断Android手机的Rom是MIUI及获取MIUI版本
- 多态和重载的区别
- cat > a.txt << EndOfFile
- 电视盒子的选购和使用技巧
- 应用反射技术改变ListView快速滑动条
- STL中list的排序算法
- Flex+Struts2结合实现文件下载
- linux拷贝文件夹
- CTS测试标准
- GregorianCalendar 的使用方法
- servletContext的使用
- hduoj-2546 饭卡(01背包)
- mysql实现远程连接的具体步骤
- 新的开始