2019年2月17日

set相关算法(includes,set_union,set_intersection,set_difference)

摘要: includes S1内含S2的一个子集合,如果元素在s2出现n次,在S1出现m次,若n>m则会返回false //版本一:用operator <比较元素 template <class InputerIterator1,class InputerIterator2> bool includes(I 阅读全文

posted @ 2019-02-17 20:08 tianzeng 阅读(248) 评论(0) 推荐(0) 编辑

合并两个sorted ranges(merge和inplace_merge)

摘要: merge //版本一:用operator <比较元素 template <class InputerIterator1,class InputerIterator2,class OutputIterator> OutputIterator merge(InputerIterator1 first1 阅读全文

posted @ 2019-02-17 18:53 tianzeng 阅读(279) 评论(0) 推荐(0) 编辑

二分查找法(binary_search,lower_bound,upper_bound,equal_range)

摘要: binary_search(二分查找) //版本一:调用operator<进行比较 template <class ForwardIterator,class StrictWeaklyCompareable> bool binary_search(ForwardIterator first,Forw 阅读全文

posted @ 2019-02-17 14:37 tianzeng 阅读(245) 评论(0) 推荐(0) 编辑

对某个区间操作(sort,stable_sort,parital_sort,parital_sort_copy,nth_element,is_sorted)

摘要: sort 参数为随机迭代器,只有vector和deque使用sort算法;在介绍SGI的快排之前先介绍以下几种排序。 insertion sort 直接插入排序。 template<class RandomAccessIterator> void __insertion_sort(RandomAcc 阅读全文

posted @ 2019-02-17 11:41 tianzeng 阅读(356) 评论(0) 推荐(0) 编辑

导航