chapter_array_and_linkedlist/linked_list/ #83
Replies: 129 comments 200 replies
-
|
请教k大,在fig.链表定义与存储方式图中,浅蓝色的存储结点指针是占用一块内存地址吗?还是和结点值各占一半呢?谢谢解答。 |
Beta Was this translation helpful? Give feedback.
-
|
请教k大!在看图Fig. 链表定义与存储方式和下面的代码时,感觉有些奇怪,这两个描述的是不是不是一个层面,在java中一切都是对象,那绿色的值的节点存的也是指针吧,那他们一个是内存层面一个是代码层面,不是一个层面的数据结构为什么能直接运用到java的对象中呢? |
Beta Was this translation helpful? Give feedback.
-
|
k神链表常用操作里,“输出结点在链表中的索引”,代码都是return -1, 是不是应该return index? |
Beta Was this translation helpful? Give feedback.
-
|
链表访问节点处的代码的for循环中,先令 head = head.next 再判断 head 是否为空,请问一下先判断head.next 是否为空,若为空则返回 null ;不为空再令 head = head.next 会不会好一点点。 |
Beta Was this translation helpful? Give feedback.
-
|
想问一下 链表的插入和删除确实是O(1) 但是查找既然是需要遍历。那应该是O(n)不是么? |
Beta Was this translation helpful? Give feedback.
-
|
刪除結點後,是不是把 P.next 設為 None比較好呢? |
Beta Was this translation helpful? Give feedback.
-
|
Fig. 在链表中插入与删除结点示意图中,插入操作示例 节点P的插入顺序错了,应该是 |
Beta Was this translation helpful? Give feedback.
-
|
想问一下github里,主函数里面为什么没有链表的定义,只有链表初始化?谢谢 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
k神请教一个问题,python里的链表的定义比较好理解,定义了一个ListNode类,这个类有两个属性,一个是存储的值,另一个是指向下一个数据的地址。 但是c++的这个结构体的定义看着我有点迷糊。 |
Beta Was this translation helpful? Give feedback.
-
|
好清晰的说明,要是当时学数构有这边书就好了。(•̀ω•́ 」∠) |
Beta Was this translation helpful? Give feedback.
-
|
经典,膜拜的第n遍,每次阅读都有不一样的收获,对于我这种似懂非懂算法的小白来说。非常nice的开源项目~ |
Beta Was this translation helpful? Give feedback.
-
|
看这个之前自己也买了本书,最终发现还是作者讲得好啊。让我从原理明白了数据结构的魅力 |
Beta Was this translation helpful? Give feedback.
-
|
可以添加一些链表的常见应用 单向链表单向链表是一种常见的链表结构,每个节点包含一个指向下一个节点的指针。
环形链表首尾相接的链表结构,
双向链表双向链表是一种链表结构,每个节点都包含指向前一个节点和后一个节点的指针。
|
Beta Was this translation helpful? Give feedback.
-
|
大佬,请教一下,删除链表元素P的时候,N0指向N1就可以了,但是P还是指向的N1,那P最终是被GC回收了吗 |
Beta Was this translation helpful? Give feedback.
-
python语法小白笔记
self.next: ListNode | None = None
if __name__ == "__main__":
```只在执行文件时运行,作为模块导入时需要放在`if __name__ == "__main__":`之外
3.函数参数
```python
def print_list(head: ListNode):
while head:
print(head.val, end=" -> " if head.next else "\n")
head = head.next
|
Beta Was this translation helpful? Give feedback.
-
|
c才是好玩哇,指针,指针的地址 typedef int ElemType; typedef struct LinkNode { // 创建新节点 // 初始化链表(头节点) // 头插法创建链表 // 尾插法创建链表 } // 打印链表 } // 检查链表是否为空 // 释放链表内存 int main() { } |
Beta Was this translation helpful? Give feedback.
-
|
感谢来信,你的邮件已经收到。
|
Beta Was this translation helpful? Give feedback.
-
|
把我的也分享一下,Rust |
Beta Was this translation helpful? Give feedback.
-
|
感谢来信,你的邮件已经收到。
|
Beta Was this translation helpful? Give feedback.
-
|
在java中由于不考虑内存清理问题,所以,链表节点的删除,也可以直接如下: |
Beta Was this translation helpful? Give feedback.
-
|
感谢来信,你的邮件已经收到。
|
Beta Was this translation helpful? Give feedback.
-
|
抱歉我也不太清楚,我之前在网页上留过言,但是之后不知道为什么一直会抄送,如果打扰到你真的抱歉
zhao
***@***.***
|
Beta Was this translation helpful? Give feedback.
-
|
我不知道,好像是平台的设置,我个人没有抄送
…-----原始邮件-----
发件人:HNUIsak ***@***.***>
发送时间:2025-09-25 17:34:09 (星期四)
收件人: krahets/hello-algo ***@***.***>
抄送: kang_wang ***@***.***>, Comment ***@***.***>
主题: Re: [krahets/hello-algo] chapter_array_and_linkedlist/linked_list/ (Discussion #83)
抱歉不好意思打扰一下 请问一下为什么我一直能收到来自您的抄送邮件呢?
在 2025-09-24 17:18:53,"iLoveRatRace" ***@***.***> 写道:
感谢来信,你的邮件已经收到。
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
Kang Wang
Haiyun campus, Xiamen University, Siming District, Xiamen 361005
Department of Mathematical Sciences · Department of Information and Computational Mathematics · Laboratory Building 501
Phone: +86 184 5554 3368
|
Beta Was this translation helpful? Give feedback.
-
|
2025.10.20 打卡! |
Beta Was this translation helpful? Give feedback.
-
|
感谢来信,你的邮件已经收到。
|
Beta Was this translation helpful? Give feedback.
-
|
2025年10月21日21:54:53加油! |
Beta Was this translation helpful? Give feedback.
-
|
您好,想请问一下链表中结点指针指向的是下一个节点的首地址,还是下一个节点存放指针的位置,我看图4-5指向的是存放指针的位置,但是问AI说的是下一个节点的首地址 |
Beta Was this translation helpful? Give feedback.
-
|
依旧是基础概念大概过一遍脑子,有个基本的了解先 |
Beta Was this translation helpful? Give feedback.
-
|
感谢来信,你的邮件已经收到。
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
chapter_array_and_linkedlist/linked_list/
动画图解、一键运行的数据结构与算法教程
https://www.hello-algo.com/chapter_array_and_linkedlist/linked_list/
Beta Was this translation helpful? Give feedback.
All reactions