Hex Blog

  • Home

  • Categories

  • Archives

  • Search

Data Struction-Iterator

Posted on 2019-02-20 | In 数据结构 | Views:

在遍历vector、list等容器时使用最多的就是迭代器,以下对迭代器做一总结: 迭代器按照定义方式分成以下四种。 正向迭代器,定义方法如下:容器类名::iterator 迭代器名; 常量正向迭代器,定义方法如下:容器类名::const_iterator 迭代器名; 反向迭代器,定义方法如下: ...

Read more »

Data Struction-Vector

Posted on 2019-02-20 | In 数据结构 | Views:

底层数据结构为数组 ,支持快速随机访问vector和built-in数组类似,它拥有一段连续的内存空间,并且起始地址不变,因此它能非常好的支持随机存取,即[]操作符,但由于它的内存空间是连续的,所以在中间进行插入和删除会造成内存块的拷贝,另外,当该数组后的内存空间不够时,需要重新申请一块足够大的内存 ...

Read more »

Data Struction-List

Posted on 2019-02-15 | Edited on 2019-07-14 | In 数据结构 | Views:

List:双向链表 list就是双向链表,元素也是在堆中存放,每个元素都是放在一块内存中,它的内存空间可以是不连续的,通过指针来进行数据的访问,这个特点使得它的随机存取变的非常没有效率,因此它没有提供[]操作符的重载。但由于链表的特点,它可以以很好的效率支持任意地方的删除和插入。 list没有空间 ...

Read more »

Template模式

Posted on 2019-01-07 | Edited on 2019-01-18 | In 设计模式 | Views:

Template模式在面向对象系统的分析与设计过程中经常会遇到这样一种情况:对于某一个业务逻辑(算法实现)在不同的对象中有不同的细节实现,但是逻辑(算法)的框架(或通用的应用算法)是相同的。Template提供了这种情况的一个实现框架。 Template模式是采用继承的方式实现这一点:将逻辑(算法 ...

Read more »

Time Complexity

Posted on 2019-01-07 | Edited on 2020-02-18 | In 数据结构 | Views:

Name Insert Access Search Delete Comments Array O(n) O(1) O(n) O(n) Insertion to the end is O(1). Details here. (Hash)Map O(1)* O(1)* O(1)* ...

Read more »

Hello World AND Markdown

Posted on 2019-01-04 | Edited on 2020-02-14 | Views:

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in ...

Read more »
123

26 posts
7 categories
9 tags
© 2022 produce by Hehj. All rights reserved.