当前位置: 首页 > news >正文

CSP初赛——STL中的函数整理

CSP初赛——STL中的函数整理

  • STL 常用数据结构及其操作函数
  • 通用算法函数(位于`<algorithm>`头文件中)

STL 常用数据结构及其操作函数

数据结构所在头文件常用操作函数功能描述
vector<vector>push_back(), pop_back(), size(), empty(), resize(), reserve(), operator[], at(), front(), back(), insert(), erase(), clear(), begin(), end(), rbegin(), rend()动态数组,支持随机访问,尾部插入删除高效
deque<deque>push_back(), pop_back(), push_front(), pop_front(), size(), empty(), resize(), operator[], at(), front(), back(), insert(), erase(), clear(), begin(), end(), rbegin(), rend()双端队列,支持首尾高效插入删除,支持随机访问
list<list>push_back(), pop_back(), push_front(), pop_front(), size(), empty(), front(), back(), insert(), erase(), clear(), begin(), end(), rbegin(), rend(), remove(), remove_if(), unique(), sort(), merge(), splice(), reverse()双向链表,任意位置插入删除高效,不支持随机访问
forward_list<forward_list>push_front(), pop_front(), insert_after(), erase_after(), before_begin(), begin(), end(), empty(), front(), clear(), remove(), remove_if(), unique(), sort(), merge(), splice_after(), reverse()单向链表,比list更节省空间,只支持前向遍历
stack<stack>push(), pop(), top(), size(), empty()栈,后进先出(LIFO)容器适配器
queue<queue>push(), pop(), front(), back(), size(), empty()队列,先进先出(FIFO)容器适配器
priority_queue<queue>push(), pop(), top(), size(), empty()优先队列,默认最大堆实现
set<set>insert(), erase(), find(), count(), lower_bound(), upper_bound(), equal_range(), size(), empty(), clear(), begin(), end(), rbegin(), rend()有序集合,元素唯一,基于红黑树实现
multiset<set>同上,但允许重复元素有序多重集合,基于红黑树实现
map<map>insert(), erase(), find(), count(), lower_bound(), upper_bound(), equal_range(), operator[], at(), size(), empty(), clear(), begin(), end(), rbegin(), rend()有序映射,键值对,键唯一,基于红黑树实现
multimap<map>同上,但允许重复键有序多重映射,基于红黑树实现
unordered_set<unordered_set>insert(), erase(), find(), count(), bucket_count(), load_factor(), rehash(), size(), empty(), clear(), begin(), end()无序集合,元素唯一,基于哈希表实现
unordered_multiset<unordered_set>同上,但允许重复元素无序多重集合,基于哈希表实现
unordered_map<unordered_map>insert(), erase(), find(), count(), operator[], at(), bucket_count(), load_factor(), rehash(), size(), empty(), clear(), begin(), end()无序映射,键值对,键唯一,基于哈希表实现
unordered_multimap<unordered_map>同上,但允许重复键无序多重映射,基于哈希表实现
array<array>operator[], at(), front(), back(), begin(), end(), rbegin(), rend(), size(), empty(), fill(), swap()固定大小数组,支持随机访问
string<string>operator[], at(), front(), back(), begin(), end(), rbegin(), rend(), size(), length(), empty(), clear(), append(), push_back(), pop_back(), insert(), erase(), replace(), substr(), find(), rfind(), find_first_of(), find_last_of(), compare(), c_str(), stoi(), to_string()(非成员函数)字符串类,类似vector但专为字符设计

通用算法函数(位于<algorithm>头文件中)

算法类别常用函数功能描述
非修改序列操作all_of(), any_of(), none_of(), for_each(), count(), count_if(), mismatch(), find(), find_if(), find_if_not(), find_end(), find_first_of(), adjacent_find(), search(), search_n()不修改容器内容的操作
修改序列操作copy(), copy_if(), copy_n(), copy_backward(), move(), move_backward(), fill(), fill_n(), transform(), generate(), generate_n(), remove(), remove_if(), remove_copy(), remove_copy_if(), replace(), replace_if(), replace_copy(), replace_copy_if(), swap(), swap_ranges(), iter_swap(), reverse(), reverse_copy(), rotate(), rotate_copy(), shuffle(), unique(), unique_copy()修改容器内容的操作
排序操作sort(), stable_sort(), partial_sort(), partial_sort_copy(), is_sorted(), is_sorted_until(), nth_element()排序及相关操作
二分查找操作lower_bound(), upper_bound(), equal_range(), binary_search()在已排序范围上进行二分查找
堆操作make_heap(), push_heap(), pop_heap(), sort_heap(), is_heap(), is_heap_until()堆相关操作
最值操作max(), min(), max_element(), min_element(), clamp()(C++17)查找最大最小值
其他操作permutations(), next_permutation(), prev_permutation(), lexicographical_compare(), iota(), accumulate(), inner_product(), adjacent_difference(), partial_sum()其他有用算法
http://www.dtcms.com/a/391281.html

相关文章:

  • 小杰机器学习高级(two)——极大似然估计、交叉熵损失函数
  • 关于px4 1.15.0电机控制有效矩阵的更新
  • 【设计模式】职责链模式
  • 22届考研(华为oD)-Java面经
  • 轻松实践:用Python实现“名字大作战”游戏,表白Zulu
  • EasyDSS视频直播点播平台如何为游戏直播提供超强技术底座?
  • MySQL----MVCC机制
  • 设计|str增量法|计算贡献
  • Spring中Controller层中容易搞混的注解
  • Git GitHub 个人账户创建教程
  • Python学习系统计划:从零到精通的科学路径
  • 解锁 JavaScript 的数学魔法:深入探索 Math 对象
  • dcm4che系列主要开源项目概述
  • 枚举深入解析
  • Qt中delete与deleteLater()的使用
  • AD5621(单通道缓冲电压输出DAC)芯片的详细用法
  • vLLM的面试题
  • 最优控制3 -- 动态规划-一个解析解的例子
  • 深入分析大众点评 Ajax 接口:直接请求 JSON 数据高效获取评论
  • 京东零售张科:DataAI Infra会成为驱动未来的技术基石
  • Java 运维中的一些常用命令
  • 用 go-commons 打造一套最小可行监控体系
  • 广东省省考备考(第一百零二天9.19)——言语(拔高突破第二节课)
  • 在vscode中,在powershell 下,如何进入子目录?
  • 易语言源码怎么制作软件 易语言源码和模块怎么做成软件
  • 4-2〔O҉S҉C҉P҉ ◈ 研记〕❘ WEB应用攻击▸目录遍历漏洞-B
  • 【Javaweb】http协议-请求与响应
  • 内网穿透系列十三:wstunnel 一款通过 Websocket 或 HTTP2 隧道传输的内网穿透工具
  • 【开关电源篇】自激振荡开关电源原理详解-从模块解析到故障维修
  • SpringBoot+Vue实现图片上传