
数据结构
文章平均质量分 54
路途…
Reading is a long investment.During this process, find the entertainment and enjoy life while treasure the present to compound interest.
展开
-
【数据结构】跳表
SkipList(跳表)这种数据结构是由William Pugh于1990年在在 Communications of the ACM June 1990, 33(6) 668-676 发表了Skip lists: a probabilistic alternative to balanced trees。原创 2022-08-10 23:22:50 · 317 阅读 · 0 评论 -
【STL序列容器】heap
heap 并不归属于 STL 容器组件,但是作为 priority queue 的底层实现 1. push_heap template <class RandomAccessIterator> inline void push_heap(RandomAccessIterator first, RandomAccessIterator last) { //此函数被调用时,新元素已经位于底部容器的最低端 __pu.原创 2022-04-15 17:20:54 · 206 阅读 · 0 评论 -
【STL序列容器】slist
slist:迭代器属于单向的 Forward Iterator(可读写)。 list :迭代器属于双向的 Bidirectional Iterator(可以双向读写)。 看起来 slist 的功能应该会不如 list,但由于其单向链表的实现,其消耗的空间更小,某些操作更快。 1. 数据结构 struct __slist_node_base { __slist_node_base* next; }; template <class T> struct __sli..原创 2022-04-15 17:18:40 · 832 阅读 · 0 评论 -
【STL序列容器】deque
deque 是一种双向开口的连续线性空间,可以在头部和尾部进行元素的插入和删除操作 对 deque 进行排序,为了提高效率,先将 deque 复制到一个 vector 上,将 vector 排序后的元素复制到 deque 中 deque 是分段连续空间,维护其整体连续的假象任务,通过迭代器 ++,– 1. 数据结构 .1. 内存分配 deque 采用一块所谓的 map(不是 STL 的 map 容器),作为主控,这里的 map 是一小块连续空间,其中每个元素(node)都是一个指针,指...原创 2022-04-15 17:17:15 · 1075 阅读 · 0 评论 -
【STL序列容器】vector
vector 底层实现使用连续数组,提供动态数组功能 1. 数据结构 template <class T, class Alloc = alloc> class vector { protected: iterator start; iterator finish; iterator end_of_storage; }; 2. 构造&添加 .1. construct 操作 // 建构式,指定 vector 大小 n 和初值 value v.原创 2022-04-15 17:16:00 · 776 阅读 · 0 评论