01. 链表基础知识 #69
Replies: 8 comments 2 replies
-
这里为什么要默认第一个节点值为0 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
捉虫:2.1第二段LinkedList写成了ListkedList |
Beta Was this translation helpful? Give feedback.
-
原文已更改,感谢指正哈~ |
Beta Was this translation helpful? Give feedback.
-
链表尾部删除元素的代码中,在if部分除了要判断self.head.next不是None外,是否还要判断self.head本身也不是None?也就是if not self.head or not self.head.next. 这样的话,只要self.head或者self.head.next中至少有一个为None,则会执行if语句输出'Error". |
Beta Was this translation helpful? Give feedback.
-
2.3求线性链表长度时应该不包含头节点,cur = self.head是不是要修改为cur = self.head.next? |
Beta Was this translation helpful? Give feedback.
-
在头部插入元素时的操作,好像与头节点的定义有冲突 |
Beta Was this translation helpful? Give feedback.
-
建议!:2.2 建立def create时最好说明一下这是在LinkedList类内的方法,不然初学者很容易迷惑为什么可以直接调用self.head |
Beta Was this translation helpful? Give feedback.
-
01.链表基础知识 | 算法通关手册
链表基础知识 # 1. 链表简介 # 1.1 链表定义 # 链表(Linked List):一种线性表数据结构。它使用一组任意的存储单元(可以是连续的,也可以是不连续的),来存储一组具有相同类型的数据。
简单来说,「链表」 是实现线性表的链式存储结
https://algo.itcharge.cn/02.Linked-List/01.Linked-List-Basic/01.Linked-List-Basic/
Beta Was this translation helpful? Give feedback.
All reactions