1.数组

​ 数组是有限个相同类型发变量所组成的有序集合,数组中的每一个变量被称为元素,数组是最简单、最常用的数据结构。

​ 数组的另一个特点是在内存中顺序存储,因此可以很好地思想逻辑上的顺序表。

数组的基本操作
操作 时间复杂度
读取元素 O(1)
更新元素 O(1)
O(n)
删除元素 O(n)
数组的优势和劣势

优势:数据具有非常高效的随机访问能力,只要给出下标,就可以用常量时间找到对应的元素,二分查找就是利用了数组的这个优势。

劣势:体现在插入和删除元素方面,由于数据元素连续紧密地存储在内存中,插入、删除元素会导致大量元素被迫移动,影响效率。

总体来说,数据适合读操作多,写操作少的场景。

2.链表

链表是一种在物理存储上非连续非顺序的数据结构,有若干节点所组成。

单向链表的每一个节点包含两部分,一部分是存放数据的变量,一部分是厨房指向下一个节点的指针。

双向链表比单向链表稍微复杂一些,它的每个节点除了拥有数据和下一个节点的指针为,还拥有指向前一个节点的指针。

链表的基本操作
操作 时间复杂度
查找元素 O(n)
更新节点 不考虑查找过程的话是O(1)
插入节点 不考虑查找过程的话是O(1)
删除元素 不考虑查找过程的话是O(1)
数组 vs 链表
结构 查找 更新 插入 删除
数组 O(1) O(1) O(n) O(n)
链表 O(n) O(1) O(1) O(1)

数组的优势在于能快速定位元素,对于读操作多、写操作少的场景,用数据更适合。

链表的优势在于能够灵活地进行插入和删除操作,如果需要在尾部频繁插入、删除元素,用链表更合适(?存疑,在尾部插入/删除元素使用数组应该更适合)

3.栈

​ 栈是一种线性数据结构,栈中的元素只能先进后出(FILO),最早进入的元素存放的位置叫栈低,最后进入的元素存放的位置叫栈顶。

栈的基本操作
操作 时间复杂度
入栈 O(1)
出栈 O(1)

4.队列

​ 队列是一种线性数据结构,队列中的元素只能先进先出(FIFO),队列的出口端叫对头,队列的入口端叫队尾。

队列的基本操作
操作 时间复杂度
入队 O(1)
出队 O(1)

5.散列表

​ 散列表也叫哈希表(hash table),这种数据结构提供了键(Key)和值(Value)的映射关系。只要给出一个Key,就可以高效找到它所匹配的Value,时间复杂度接近于O(1)。

散列表的基本操作
操作 时间复杂度
写操作 不同实现介于O(1)~O(n)间
读操作 接近于O(1)

49 条评论

social signals seo service · 2023年4月15日 上午3:25

social signals seo service

qpjpgdzky kwcdd fpjkioo sqio naakbtdiwuqdqkn

organising · 2023年4月17日 上午6:30

… [Trackback]

[…] There you will find 45426 more Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

avença informática · 2023年4月18日 下午9:46

… [Trackback]

[…] Read More here to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

คาสิโนออนไลน์ · 2023年4月19日 上午6:42

… [Trackback]

[…] Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

passive income · 2023年4月25日 上午8:26

… [Trackback]

[…] Here you will find 26190 more Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

Ozempic · 2023年4月25日 下午5:35

… [Trackback]

[…] Here you can find 85028 more Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

Realistic tattoo Khao Lak · 2023年4月27日 上午6:35

… [Trackback]

[…] Info to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

แทงบอลออนไลน์ · 2023年4月27日 上午7:03

… [Trackback]

[…] Here you will find 98412 more Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

mossburg · 2023年5月12日 下午6:31

… [Trackback]

[…] Here you can find 20380 more Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

apps to make money on · 2023年5月18日 上午1:13

… [Trackback]

[…] Read More on on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

Kaws OG Drank · 2023年5月23日 下午3:51

… [Trackback]

[…] Find More on on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

massage outcall Bangkok · 2023年5月24日 上午7:16

… [Trackback]

[…] There you will find 95398 additional Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

https://www.roids4european.com/ · 2023年6月5日 上午7:17

… [Trackback]

[…] Find More Info here to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

Anabolika Kaufen Deutschland · 2023年6月13日 上午6:40

… [Trackback]

[…] Find More on on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

bonanza178 · 2023年6月23日 上午12:22

… [Trackback]

[…] Find More to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

liberty cap mushroom season uk 2022 · 2023年6月26日 下午12:39

… [Trackback]

[…] Find More Info here on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

sahabatkartu · 2023年7月4日 下午6:24

… [Trackback]

[…] Read More here to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

texasguntrader · 2023年7月5日 上午10:28

… [Trackback]

[…] Read More on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

benelli m3 · 2023年7月5日 下午10:41

… [Trackback]

[…] Read More Info here to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

rajabandarq · 2023年7月13日 下午4:44

… [Trackback]

[…] Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

nagaqq · 2023年7月17日 下午4:59

… [Trackback]

[…] Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

เครื่องลดความชื้น · 2023年7月19日 上午6:54

… [Trackback]

[…] Info on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

แอร์ 12000 BTU ยี่ห้อไหนดี · 2023年7月20日 上午6:38

… [Trackback]

[…] Read More to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

เตารีด ยี่ห้อไหนดี · 2023年7月20日 上午6:49

… [Trackback]

[…] Read More here to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

นำเข้าสินค้าจากจีน · 2023年7月20日 上午7:14

… [Trackback]

[…] Here you will find 36126 more Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

buy magic mushrooms online oakland California · 2023年7月20日 上午10:24

… [Trackback]

[…] Here you can find 72027 additional Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

40fakes.com · 2023年7月21日 下午5:20

… [Trackback]

[…] Info on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

slot · 2023年7月22日 上午7:26

… [Trackback]

[…] There you will find 75106 more Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

뉴토끼 · 2023年7月24日 上午4:23

… [Trackback]

[…] Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

qiuqiu99 · 2023年7月27日 下午2:49

… [Trackback]

[…] Read More on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

รับแพ็คสินค้า · 2023年7月30日 上午8:25

… [Trackback]

[…] Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

Hosting · 2023年8月2日 下午5:11

… [Trackback]

[…] There you can find 79653 additional Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ติดเน็ตบ้าน · 2023年8月3日 上午8:07

… [Trackback]

[…] Info to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ป้ายโฆษณา · 2023年8月5日 上午7:47

… [Trackback]

[…] Read More to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

n777คาสิโน · 2023年8月6日 上午8:44

… [Trackback]

[…] Read More here on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

คา สิ โน สล็อต · 2023年8月6日 上午11:06

… [Trackback]

[…] Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ค่า สิ โน w88 · 2023年8月6日 上午11:40

… [Trackback]

[…] Here you can find 87383 more Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ปั้มไลค์ · 2023年8月6日 下午12:38

… [Trackback]

[…] Read More on on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

fryd disposable · 2023年8月7日 下午9:48

… [Trackback]

[…] Read More on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ราคาบอล1x2 · 2023年8月12日 上午6:34

… [Trackback]

[…] Info to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ทางเข้า alpha88 · 2023年8月12日 上午6:41

… [Trackback]

[…] There you will find 1851 more Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ทัวร์หลีเป๊ะ · 2023年8月12日 上午6:44

… [Trackback]

[…] Find More on to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ดาวน์โหลด สล็อตออนไลน์ มือถือ · 2023年8月12日 上午7:37

… [Trackback]

[…] Read More to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

alpha88 สล็อต · 2023年8月12日 上午9:32

… [Trackback]

[…] Find More here on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

Latex Lingerie · 2023年8月16日 下午4:51

… [Trackback]

[…] Read More Info here on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

สล็อต ฝากถอน true wallet เว็บตรง 888pg · 2023年8月24日 上午7:23

… [Trackback]

[…] Information on that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

ข่าวกีฬา · 2023年8月24日 上午7:27

… [Trackback]

[…] There you can find 44660 more Information to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

vapes · 2023年8月24日 下午11:37

… [Trackback]

[…] There you will find 97856 additional Info to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

agen slot · 2023年8月29日 下午5:23

… [Trackback]

[…] Read More Information here to that Topic: hugr.cn/2019/12/02/算法和数据结构:第二章-数据结构基础/ […]

评论已关闭。