C++ STL中常用数据结构

本文介绍了C++ STL中的常用数据结构,包括vector、list、map、set、stack、queue、deque和priority_queue。vector是动态数组,提供自动扩展功能;list是双链表,插入删除操作快速;map是键值对映射,元素唯一;set存储唯一元素,不可修改;stack遵循LIFO原则;queue遵循FIFO原则;deque在两端均可插入删除,效率高;priority_queue则保证元素按优先级排序。
摘要由CSDN通过智能技术生成
常用数据结构
  • vector
  • list
  • map
  • set
  • stack
  • queue
  • deque
  • priority_queue
vector

Vectors are same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector elements are placed in contiguous storage so that they can be accessed and traversed using iterators. In vectors, data is inserted at the end takes differential time, as sometimes there may be a need of extending the arry. Removing the last element takes only constant time because no resizing happens. Inserting and erasing at the beginning or in the middle is linear in time.
Vector in C++ STL

list

Lists are sequence containers that non-contiguous memory allocation. As

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值