摘要: set集合 set一种容器,用于储存唯一的元素(不允许重复),并按照升序排序(<) 内部实现是红黑树 比较函数重置 greater函数 #include<bits/stdc++.h> using namespace std; int main() { set<int,greater<int>> my 阅读全文
posted @ 2024-03-03 19:00 777CC 阅读(68) 评论(0) 推荐(0) 编辑
摘要: queue队列 先进先出 priority_queue优先队列 底层逻辑是堆 按照一定的优先级进行排序的 从大到小 修改比较函数的方法 自定义比较函数 struct Compare { bool operator()(int a,int b)//operator()重载运算符 { return a 阅读全文
posted @ 2024-03-03 17:13 777CC 阅读(10) 评论(0) 推荐(0) 编辑
摘要: stack的定义和结构 先进先出 底层容器类型 deque 头文件<stack> stack的常用函数 代码示例 #include<bits/stdc++.h> using namespace std; int main() { //声明stack stack<int> mystack; //插入元 阅读全文
posted @ 2024-03-03 16:48 777CC 阅读(4) 评论(0) 推荐(0) 编辑
摘要: list的定义与结构 双向链表容器 节点(node)储存元素 指针链接 list<int> mylist 特点 双向性,含有两个指针 能随意插入删除,直接改变指针指向就好 不能任意访问元素,必须便利 动态大小 可以不连续 list的常用函数 push_back():将元素插入到链表的末尾 push_ 阅读全文
posted @ 2024-03-03 16:31 777CC 阅读(5) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示