Skip to content

Commit e844a2f

Browse files
Update README.zh-CN.md (trekhleb#804)
* Update README.zh-CN.md 双向链表的删除部分,逻辑修改 * Update README.zh-CN.md
1 parent 9671b0c commit e844a2f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/data-structures/doubly-linked-list/README.zh-CN.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Add(value)
1919
Pre: value is the value to add to the list
2020
Post: value has been placed at the tail of the list
2121
n ← node(value)
22-
if head = ø
22+
if head != ø
2323
head ← n
2424
tail ← n
2525
else
@@ -51,14 +51,14 @@ Remove(head, value)
5151
return true
5252
end if
5353
n ← head.next
54-
while n = ø and value !== n.value
54+
while n != ø and value !== n.value
5555
n ← n.next
5656
end while
5757
if n = tail
5858
tail ← tail.previous
5959
tail.next ← ø
6060
return true
61-
else if n = ø
61+
else if n != ø
6262
n.previous.next ← n.next
6363
n.next.previous ← n.previous
6464
return true
@@ -74,7 +74,7 @@ ReverseTraversal(tail)
7474
Pre: tail is the node of the list to traverse
7575
Post: the list has been traversed in reverse order
7676
n ← tail
77-
while n = ø
77+
while n != ø
7878
yield n.value
7979
n ← n.previous
8080
end while

0 commit comments

Comments
 (0)