caipengbo / LeetCode

Algorithms Exercise: LeetCode Problems, LeetCode Weekly Contest etc.
https://github.com/caipengbo/LeetCode-CPP
56 stars 17 forks source link

C++容器 #4

Open caipengbo opened 5 years ago

caipengbo commented 5 years ago

C++中容器分为关联容器和顺序容器:

关联容器支持高效的关键字查找与访问,两个主要的关联容器类型是map与set。

STL主要采用向量、链表、二叉树及他们的组合作为底层存储结构来实现容器。顺序容器主要采用向量和链表及其组合作为基本存储结构,如堆栈和各种队列,而关联式容器采用平衡二叉搜索树作为底层存储结构。

caipengbo commented 5 years ago

Set: 默认是排序的,底层是红黑树