mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
添加 STL 容器链接、索引等
This commit is contained in:
parent
c633ace64b
commit
b5a17ca86d
27
README.md
27
README.md
|
@ -902,20 +902,25 @@ class doSomething(Flyable *obj) // 做些事情
|
|||
|
||||
## STL
|
||||
|
||||
### 容器底层数据结构实现
|
||||
### 索引
|
||||
|
||||
[STL 容器方法含义](https://github.com/huihut/interview/tree/master/STL)
|
||||
|
||||
### 容器
|
||||
|
||||
容器 | 底层数据结构 | 有无序 | 可不可重复 | 其他
|
||||
---|---|---|---|---
|
||||
vector|数组|无序|可重复|支持快速随机访问
|
||||
list|双向链表|无序|可重复|支持快速增删
|
||||
deque|双端队列(一个中央控制器+多个缓冲区)|无序|可重复|支持首尾快速增删,支持随机访问
|
||||
stack|deque 或 list 封闭头端开口|无序|可重复|不用 vector 的原因应该是容量大小有限制,扩容耗时
|
||||
queue|deque 或 list 封闭底端出口和前端入口|无序|可重复|不用 vector 的原因应该是容量大小有限制,扩容耗时
|
||||
priority_queue|vector|无序|可重复|vector容器+heap处理规则
|
||||
set|红黑树|有序|不可重复|
|
||||
multiset|红黑树|有序|可重复|
|
||||
map|红黑树|有序|不可重复|
|
||||
multimap|红黑树|有序|可重复|
|
||||
[array](https://github.com/huihut/interview/tree/master/STL#array)|数组|无序|可重复|支持快速随机访问
|
||||
[vector](https://github.com/huihut/interview/tree/master/STL#vector)|数组|无序|可重复|支持快速随机访问
|
||||
[list](https://github.com/huihut/interview/tree/master/STL#list)|双向链表|无序|可重复|支持快速增删
|
||||
[deque](https://github.com/huihut/interview/tree/master/STL#deque)|双端队列(一个中央控制器+多个缓冲区)|无序|可重复|支持首尾快速增删,支持随机访问
|
||||
[stack](https://github.com/huihut/interview/tree/master/STL#stack)|deque 或 list 封闭头端开口|无序|可重复|不用 vector 的原因应该是容量大小有限制,扩容耗时
|
||||
[queue](https://github.com/huihut/interview/tree/master/STL#queue)|deque 或 list 封闭底端出口和前端入口|无序|可重复|不用 vector 的原因应该是容量大小有限制,扩容耗时
|
||||
[priority_queue](https://github.com/huihut/interview/tree/master/STL#priority_queue)|vector|无序|可重复|vector容器+heap处理规则
|
||||
[set](https://github.com/huihut/interview/tree/master/STL#set)|红黑树|有序|不可重复|
|
||||
[multiset](https://github.com/huihut/interview/tree/master/STL#multiset)|红黑树|有序|可重复|
|
||||
[map](https://github.com/huihut/interview/tree/master/STL#map)|红黑树|有序|不可重复|
|
||||
[multimap](https://github.com/huihut/interview/tree/master/STL#multimap)|红黑树|有序|可重复|
|
||||
hash_set|hash表|无序|不可重复|
|
||||
hash_multiset|hash表|无序|可重复|
|
||||
hash_map|hash表|无序|不可重复|
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
[STL 详细文档](https://github.com/huihut/interview/blob/master/STL/STL.md)
|
||||
|
||||
# 容器(containers)
|
||||
|
||||
## array
|
||||
|
|
Loading…
Reference in New Issue
Block a user