Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb9e5ea

Browse files
committed
Update 01.Linked-List-Basic.md
1 parent 83f1519 commit bb9e5ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Contents/02.Linked-List/01.Linked-List-Basic/01.Linked-List-Basic.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def create(self, data):
103103
**「求线性链表长度」** 的代码如下:
104104

105105
```python
106-
# 获取链表长度
106+
# 获取线性链表长度
107107
def length(self):
108108
count = 0
109109
cur = self.head
@@ -126,7 +126,7 @@ def length(self):
126126
**「在链表中查找值为 $val$ 的元素」** 的代码如下:
127127

128128
```python
129-
# 查找元素
129+
# 查找元素:在链表中查找值为 val 的元素
130130
def find(self, val):
131131
cur = self.head
132132
while cur:
@@ -242,7 +242,7 @@ def insertInside(self, index, val):
242242
**「将链表中第 $i$ 个元素值改为 $val$」** 的代码如下:
243243

244244
```python
245-
# 改变元素
245+
# 改变元素:将链表中第 i 个元素值改为 val
246246
def change(self, index, val):
247247
count = 0
248248
cur = self.head
@@ -301,7 +301,7 @@ def removeFront(self):
301301
```python
302302
# 链表尾部删除元素
303303
def removeRear(self):
304-
if not self.head.next:
304+
if not self.head or not self.head.next:
305305
return 'Error'
306306

307307
cur = self.head

0 commit comments

Comments
 (0)