当前位置:网站首页>C + + STL container
C + + STL container
2020-11-10 08:45:00 【D3qbz0a】
Containers | Underlying data structure | Time complexity | There is disorder | It can't be repeated | other |
---|---|---|---|---|---|
array | Array | Read at random O(1) | disorder | repeatable | Support random access |
vector | Array | Read at random 、 Tail insertion 、 Tail delete O(1), Head insertion 、 Head delete O(n) | disorder | repeatable | Support random access |
deque | deque | Insert head and tail 、 Delete the beginning and the end O(1) | disorder | repeatable | A central controller + Multiple buffers , Support the rapid addition and deletion of , Support random access |
forward_list | One way linked list Insert 、 Delete O(1) | disorder | repeatable | Random access is not supported | |
list | Double linked list | Insert 、 Delete O(1) | disorder | repeatable | Random access is not supported |
stack | deque / list | Insert at the top 、 Delete at the top O(1) | disorder | repeatable | deque or list Close the head end opening , no need vector The reason should be that the capacity is limited , Expansion takes time |
queue | deque / list | Tail insertion 、 Head delete O(1) | disorder | repeatable | deque or list Close the head end opening , no need vector The reason should be that the capacity is limited , Expansion takes time |
priority_queue | vector + max-heap | Insert 、 Delete O(log2n) | Orderly | repeatable | vector Containers +heap Handling rules |
set | Red and black trees | Insert 、 Delete 、 lookup O(log2n) | Orderly | Do not repeat | |
multiset | Red and black trees | Insert 、 Delete 、 lookup O(log2n) | Orderly | repeatable | |
map | Red and black trees | Insert 、 Delete 、 lookup O(log2n) | Orderly | Do not repeat | |
multimap | Red and black trees | Insert 、 Delete 、 lookup O(log2n) | Orderly | repeatable | |
unordered_set | Hashtable | Insert 、 Delete 、 lookup O(1) The worst O(n) | disorder | Do not repeat | |
unordered_multiset | Hashtable | Insert 、 Delete 、 lookup O(1) The worst O(n) | disorder | repeatable | |
unordered_map | Hashtable | Insert 、 Delete 、 lookup O(1) The worst O(n) | disorder | Do not repeat | |
unordered_multimap | Hashtable | Insert 、 Delete 、 lookup O(1) The worst O(n) | disorder | repeatable |
版权声明
本文为[D3qbz0a]所创,转载请带上原文链接,感谢
边栏推荐
- CUDA_主机内存
- jt-day10
- [paper reading notes] large scale heterogeneous feature embedding
- 消防知识线上答题活动小程序复盘
- jt-day10
- Wu Enda's refining notes on machine learning 4: basis of neural network - Zhihu
- leetcode之最后一个单词的长度
- learning to Estimate 3D Hand Pose from Single RGB Images论文理解
- OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
- 编码风格:Mvc模式下SSM环境,代码分层管理
猜你喜欢
jmeter接口测试--带有token的解决方法
csdn bug3:待加
【LeetCode】 93 平衡二叉树
OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
CSDN bug5: to be added
Coding style: SSM environment in MVC mode, code hierarchical management
csdn bug9:待加
csdn bug8:待加
Bartender2021 realizes secure remote label printing, new year-end release
推动中国制造升级,汽车装配车间生产流水线 3D 可视化
随机推荐
小度“破圈”提速,IoT迎来新故事
[python学习手册-笔记]001.python前言
Problems and solutions in configuring FTP server with FileZilla server
推动中国制造升级,汽车装配车间生产流水线 3D 可视化
[paper reading notes] large scale heterogeneous feature embedding
lodash.js Source code flatten
编码风格:Mvc模式下SSM环境,代码分层管理
The solution of polar experience insensitive verification
使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
解决Coursera视频无法观看的三种方法(亲测有效)
《Python Cookbook 3rd》笔记(2.2):字符串开头或结尾匹配
Factory approach model
浅谈字节最新开源联邦机器学习平台Fedlearner
Commodity management - merge purchase demand into purchase order
Seam engraving algorithm: a seemingly impossible image size adjustment method
Only options request is sent, no post solution is sent
[leetcode] 92 integer inversion
[paper reading notes] community oriented attributed network embedding
编码风格:Mvc模式下SSM环境,代码分层管理
Mongodb index management of distributed document storage database