Skip to content

Commit

Permalink
添加 STL 容器链接、索引等
Browse files Browse the repository at this point in the history
  • Loading branch information
huihut committed Jun 4, 2018
1 parent c633ace commit b5a17ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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表|无序|不可重复|
Expand Down
2 changes: 2 additions & 0 deletions STL/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[STL 详细文档](https://github.com/huihut/interview/blob/master/STL/STL.md)

# 容器(containers)

## array
Expand Down

0 comments on commit b5a17ca

Please sign in to comment.