随笔分类 -  STL

摘要:头文件:#include <bitset> bitset类型在定义时就需要指定所占的空间,例如 bitset<233>bit; bitset类型可以用string和整数初始化(整数转化成对应的二进制) int main() { bitset<23>bit (string("11101001")); 阅读全文
posted @ 2020-02-10 19:47 _Ackerman 阅读(401) 评论(0) 推荐(0)
摘要:next_permutation就是按照字典序排列得到所有的排列组合! 例如 我们需要输出{ 1 , 2 , 3 , 4 } 的全排列(调用STL) 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int mai 阅读全文
posted @ 2019-12-05 21:07 _Ackerman 阅读(1215) 评论(0) 推荐(2)
摘要:优先级队列默认less 大数优先。 priority_queue<Type, Container, Functional>其中Type 为数据类型, Container 为保存数据的容器,Functional 为元素比较方式。Container 必须是用数组实现的容器,比如 vector, dequ 阅读全文
posted @ 2019-12-03 23:47 _Ackerman 阅读(245) 评论(0) 推荐(0)
摘要:c++语言中,multiset是<set>库中一个非常有用的类型,它可以看成一个序列,插入一个数,删除一个数都能够在O(logn)的时间内完成,而且他能时刻保证序列中的数是有序的,而且序列中可以存在重复的数。 简单的运用: 放入自定义的数据类型 但是这种写法的multiset其实是没有意义的,因为它 阅读全文
posted @ 2019-07-30 10:57 _Ackerman 阅读(581) 评论(0) 推荐(0)
摘要:1.关于set C++ STL 之所以得到广泛的赞誉,也被很多人使用,不只是提供了像vector, string, list等方便的容器,更重要的是STL封装了许多复杂的数据结构算法和大量常用数据结构操作。vector封装数组,list封装了链表,map和set封装了二叉树等,在封装这些数据结构的时 阅读全文
posted @ 2019-07-24 10:27 _Ackerman 阅读(525) 评论(0) 推荐(0)