chapter_array_and_linkedlist/array/ #84
Replies: 103 comments 149 replies
-
缓存局部性:简单的说是和命中率有关系,分时间局部性和空间局部性 |
Beta Was this translation helpful? Give feedback.
-
很不错,数组的插入和删除理解的重点是在索引 |
Beta Was this translation helpful? Give feedback.
-
删除索引 index 元素时,可在代码中,循环结束后,将 nums 最后位置元素重置为 0,nums[-1] = 0, 使之与图片中的末尾元素无意义概念一致。 另外,插入元素时,Python 代码中,索引是否正确? 我的理解: for i in range(len(nums) - 1, index +1, -1). |
Beta Was this translation helpful? Give feedback.
-
已fork,正着手编写数组的Go示例 |
Beta Was this translation helpful? Give feedback.
-
数组中首个元素对应数组的内存地址偏移量是0,所以数组索引从0开始算起,学到了,感谢!!! |
Beta Was this translation helpful? Give feedback.
-
/* 初始化数组 */ |
Beta Was this translation helpful? Give feedback.
-
数组遍历 C++ 代码示例,只是 count++,没有遍历数组,是不是本来要写成 count += nums[i]? |
Beta Was this translation helpful? Give feedback.
-
代码示例 应该加一下语言的语法糖写法? 比如 rust 很多情况是不用 for的 根据情况编译后的效率也比for循环高效 虽然有些矛盾。 但是我觉得可以列出两种实现方式, 一个是for 理解原理另一个是如何更简便的写法。 |
Beta Was this translation helpful? Give feedback.
-
这个网站怎么没有记录功能,是因为没有后端用户服务器吗,, |
Beta Was this translation helpful? Give feedback.
-
作者您好,为什么在这里会强调“相同类型的元素”,而在下一章链表中却没有强调同类型呢? |
Beta Was this translation helpful? Give feedback.
-
之前都是在用,没有看到这么底层 |
Beta Was this translation helpful? Give feedback.
-
“数组有多种初始化写法。根据实际需要,选代码最短的那一种就好。” k神,个人感觉这句话有点奇怪, |
Beta Was this translation helpful? Give feedback.
-
请问计算内存地址那里为什么元素长度为4呢?我看数组长度为5,为什么不是5呢 |
Beta Was this translation helpful? Give feedback.
-
您好还是不太理解c++数组删除那块,我知道有效长度-1之后最末尾的元素可以忽略掉(无意义),可是这在源代码中没有体现,请问这该如何实现呀?第二个问题是在插入的时候不应该先判断是否满数组再扩容吗?感谢解答 |
Beta Was this translation helpful? Give feedback.
-
Hello! K大,想问下您的图都是怎么画的啊,感觉也太整齐美观了,想学习一下 |
Beta Was this translation helpful? Give feedback.
-
环形链表的使用场景通常与循环访问、固定大小的数据管理或周期性任务相关。 |
Beta Was this translation helpful? Give feedback.
-
佬,删除元素那边是不是要把length-1啊,我看的是Java代码,如果不减的话最后一位元素是重复的吧 |
Beta Was this translation helpful? Give feedback.
-
话说不知道这个评论有没有编辑或删除的功能,有的时候没注意检查写错字,或者回错人,结果不能修改或删除😭 |
Beta Was this translation helpful? Give feedback.
-
一时间网上一片求救声,急问这个怎么破。其实这段代码很简单,index数组就是arr数组的下标,index[0]=2 对应 arr[2]=1,index[1]=0 对应 arr[0]=8,index[2]=3 对应 arr[3]=0,以此类推…… 很容易得到电话号码是18013820100。 本题要求你编写一个程序,为任何一个电话号码生成这段代码 —— 事实上,只要生成最前面两行就可以了,后面内容是不变的。 输入格式: 输出格式: 输入样例:
麻烦各位了!!! |
Beta Was this translation helpful? Give feedback.
-
insert函数如果定义为插入的话,代码实现感觉就有点出入了,因为丢掉了最后的元素:
|
Beta Was this translation helpful? Give feedback.
-
从地址计算公式的角度看,索引本质上是内存地址的偏移量。突然就醍醐灌顶了。 |
Beta Was this translation helpful? Give feedback.
-
作者大大您好,我是一个初学者,所以不太清楚c++的访问元素以及后续的代码中为什么要在括号里加入int *nums这一部分,我查到了这个是指针的意思,它的具体作用是什么嘞 |
Beta Was this translation helpful? Give feedback.
-
原来如此!非常感谢作者大大
发自我的iPhone
…------------------ Original ------------------
From: Aldebaran-ls ***@***.***>
Date: Fri,Nov 22,2024 0:12 AM
To: krahets/hello-algo ***@***.***>
Cc: TOKKOW ***@***.***>, Comment ***@***.***>
Subject: Re: [krahets/hello-algo] chapter_array_and_linkedlist/array/(Discussion #84)
|
Beta Was this translation helpful? Give feedback.
-
准备去集中刷一下数组的题,巩固一下所学哒。加油! |
Beta Was this translation helpful? Give feedback.
-
2024-12-12打卡 |
Beta Was this translation helpful? Give feedback.
-
2024-12-14 打卡 |
Beta Was this translation helpful? Give feedback.
-
缺席了一段时间,打卡Day4 |
Beta Was this translation helpful? Give feedback.
-
day3,争取一天一章 |
Beta Was this translation helpful? Give feedback.
-
chapter_array_and_linkedlist/array/
动画图解、一键运行的数据结构与算法教程
https://www.hello-algo.com/chapter_array_and_linkedlist/array/
Beta Was this translation helpful? Give feedback.
All reactions