chapter_array_and_linkedlist/summary/ #150
Replies: 29 comments 29 replies
-
对 Cache locality 的一个简单解释:Why does cache locality matter for array performance? |
Beta Was this translation helpful? Give feedback.
-
"列表的出现大大提升了数组的实用性,但副作用是会造成部分内存空间浪费",这里的”部分内存空间浪费“是指额外增加的变量如容量、长度、扩容倍数所占的内存吗? |
Beta Was this translation helpful? Give feedback.
-
Q&A看得我云里雾里,不过小结的总结很简练。局部缓存的知识感觉很及时 |
Beta Was this translation helpful? Give feedback.
-
Q&A的最后一条的解释可能不是很完美。在Python中分代码块,如果在同一个代码块里面,则采用统一代码块下的缓存机制。如果属于不同的代码块,则采用小数据池的缓存机制(可以理解成单例的或者全局的字典),而且对于int类型来说,小数据池的缓存范围在-5到256 |
Beta Was this translation helpful? Give feedback.
-
JavaScript中数组没有要求一定要是一样的类型吧?目前在学java感觉两科语言差异还是有蛮多的 |
Beta Was this translation helpful? Give feedback.
-
Hi, K神, |
Beta Was this translation helpful? Give feedback.
-
关于Q&A第一条有些不懂的地方 |
Beta Was this translation helpful? Give feedback.
-
关于Q&A中 在 Python 中初始化 n = [1, 2, 3] 与初始化 m = [2, 1, 3] |
Beta Was this translation helpful? Give feedback.
-
python中的列表是本文提到的动态数组吗。列表允许存储不同类型的元素,但数组要求相同类型的元素 |
Beta Was this translation helpful? Give feedback.
-
例如,双向队列适合使用链表实现,我们维护一个指针变量始终指向头结点、尾结点,每次插入与删除操作都是 O(1)。 |
Beta Was this translation helpful? Give feedback.
-
对于“初始化列表 res = [0] * self.size() 操作,会导致 res 的每个元素引用相同的地址吗?”这个问题。在python中,正如您之前讲到的列表中每个数字都是一个引用,那您回答中的“初始化二维列表 res = [[0] * self.size()] 多次引用了同一个列表 [0]”是如何发现的呢? |
Beta Was this translation helpful? Give feedback.
-
想问一下:有没有推荐的相应的题目可以用来巩固和拓展的呀 |
Beta Was this translation helpful? Give feedback.
-
对于 “ 初始化列表 res = [0] * self.size() 操作,会导致 res 的每个元素引用相同的地址吗?” 这个问题,运行下面的代码得到每个对象的 id 地址值是同样的,那为什么答案是 "不会引用相同的地址" 呢? res = [0] * 5
for r in res:
print(id(r)) |
Beta Was this translation helpful? Give feedback.
-
two day. |
Beta Was this translation helpful? Give feedback.
-
我对数组和链表增删和查找的时间复杂度O(1)和O(n)的理解是这样的: |
Beta Was this translation helpful? Give feedback.
-
这些知识点零散的在各个地方看到过,但能在算法上串联起来,之前是没想过的,我熟练度应该还是太低了 |
Beta Was this translation helpful? Give feedback.
-
帅,这些问题的提出也太好了,少部分是自己也疑惑的,更多的是完全没有考虑的像是二维数组里面初始化,像是python里数组里存储的是引用。 |
Beta Was this translation helpful? Give feedback.
-
你好,第四个问题: |
Beta Was this translation helpful? Give feedback.
-
2024.4.23 chapter 4 finish. |
Beta Was this translation helpful? Give feedback.
-
最后一个Question的 |
Beta Was this translation helpful? Give feedback.
-
打卡,数组和链表两种线性数据结构,都支持数据插入,删除,查询,修改.数组空间长度不可变,空间效率低.链表分散存储的特性使得它可以有效利用空间,但链表的查修操作的时间复杂度为O(n).列表是一种抽象的数据结构概念,可以由数组或者链表形成,它也称为动态数组,可以动态地进行扩容,从而克服了数组长度不可变的缺点 |
Beta Was this translation helpful? Give feedback.
-
你的邮件我已经收到!
|
Beta Was this translation helpful? Give feedback.
-
2024.5.29直接拿下打卡! 数组和链表这两种数据结构是互补的, 今天才知道列表原来是一种抽象的数据结构概念,是可以动态修改并支持增删查改的数据结构,之前一直和链表混着用。 还有这两种数据结构对于缓存机制有着不同的效益,综合看用数组偏多,实际还是看具体需求,链表更多地应用在数据动态性更强的案例中。 发现不管是力扣题目还是hello算法介绍,在python语言上,都会去使用类别注释,个人觉得还是比较好的习惯,我之前觉得麻烦一直没有使用类别注释,觉得后面需要培养这个习惯。因为python天生支持多态的特性,而其他语言比如java和c++都需要明确指出数据类型,对于代码解释性更强。 |
Beta Was this translation helpful? Give feedback.
-
列表这里可以看一下Java的源码 虽然我算法学的是c++ 哈哈。。使用c++实时模拟一下列表实现,很有用,特别是感受数组扩容与设置报错的过程,对自己的编程逻辑很有好处 |
Beta Was this translation helpful? Give feedback.
-
每一章或者每一小节后面是不是可以给一些相关的算法题(或者力扣题的地址)以供练习更好 |
Beta Was this translation helpful? Give feedback.
-
chapter_array_and_linkedlist/summary/
一本动画图解、能运行、可提问的数据结构与算法入门书
https://www.hello-algo.com/chapter_array_and_linkedlist/summary/
Beta Was this translation helpful? Give feedback.
All reactions