摘要: 堆排序算法( heapsort ) 2. make_heap() 2. push_heap() 3. pop_heap 4. sort_heap() #include <iostream> #include <algorithm> #include <vector> using namespace 阅读全文
posted @ 2015-03-10 18:07 SandKing 阅读(5) 评论(0) 推荐(0)
摘要: 1. nth_element( b, n, e ) 对n位置的元素进行比较,大的放后面,小的放前面,n必须是迭代器指向输入的元素; 2. nth_element(b, n, e, p ) 3.对比:partition() 算法 #include <iostream> #include <algori 阅读全文
posted @ 2015-03-10 16:51 SandKing 阅读(5) 评论(0) 推荐(0)
摘要: 1. partial_sort( b, se, e ) 2. partial_sort( b, se, e, p ) 3. partial_sort_copy( sb, se, db, de ) 4. partial_sort_copy( sb, se, db, de, p ) #include < 阅读全文
posted @ 2015-03-10 15:09 SandKing 阅读(4) 评论(0) 推荐(0)
摘要: 1. sort( b, e) 2. sort( b, e, p ) 3. stable_sort( b, e ) 4. stable_sort( b, e, p ) 注意: 不适用于list容器,list有成员函数sort #include <iostream> #include <algorith 阅读全文
posted @ 2015-03-10 14:07 SandKing 阅读(4) 评论(0) 推荐(0)
摘要: 1. random_shuffle() 随机打乱 2. partition() 不稳定的 3. stable_partition() 稳定的 #include <iostream> #include <algorithm> #include <vector> #include <iterator> 阅读全文
posted @ 2015-03-10 12:40 SandKing 阅读(8) 评论(0) 推荐(0)
摘要: 1. next_permutation() 原始数据为升序 2. prev_permutation() 原始数据为降序 #include <iostream> #include <algorithm> #include <vector> using namespace std; int main( 阅读全文
posted @ 2015-03-10 11:56 SandKing 阅读(8) 评论(0) 推荐(0)
摘要: 1. reverse() 2. reverse_copy() 3. rotate() 4. rotate_copy() #include <iostream> #include <algorithm> #include <vector> #include <iterator> using names 阅读全文
posted @ 2015-03-10 11:36 SandKing 阅读(9) 评论(0) 推荐(0)