Open caipengbo opened 5 years ago
C++中容器分为关联容器和顺序容器:
关联容器支持高效的关键字查找与访问,两个主要的关联容器类型是map与set。
STL主要采用向量、链表、二叉树及他们的组合作为底层存储结构来实现容器。顺序容器主要采用向量和链表及其组合作为基本存储结构,如堆栈和各种队列,而关联式容器采用平衡二叉搜索树作为底层存储结构。
Set: 默认是排序的,底层是红黑树
C++中容器分为关联容器和顺序容器:
关联容器支持高效的关键字查找与访问,两个主要的关联容器类型是map与set。
STL主要采用向量、链表、二叉树及他们的组合作为底层存储结构来实现容器。顺序容器主要采用向量和链表及其组合作为基本存储结构,如堆栈和各种队列,而关联式容器采用平衡二叉搜索树作为底层存储结构。