From e844a2f894fa3873bacd62d0fff4f346f9273f99 Mon Sep 17 00:00:00 2001 From: jackbyebye1024 <57267425+jackbyebye1024@users.noreply.github.com> Date: Sat, 22 Jan 2022 17:43:11 +0800 Subject: [PATCH] Update README.zh-CN.md (#804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README.zh-CN.md 双向链表的删除部分,逻辑修改 * Update README.zh-CN.md --- src/data-structures/doubly-linked-list/README.zh-CN.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data-structures/doubly-linked-list/README.zh-CN.md b/src/data-structures/doubly-linked-list/README.zh-CN.md index 03dd53c1..097ec0c9 100644 --- a/src/data-structures/doubly-linked-list/README.zh-CN.md +++ b/src/data-structures/doubly-linked-list/README.zh-CN.md @@ -19,7 +19,7 @@ Add(value) Pre: value is the value to add to the list Post: value has been placed at the tail of the list n ← node(value) - if head = ø + if head != ø head ← n tail ← n else @@ -51,14 +51,14 @@ Remove(head, value) return true end if n ← head.next - while n = ø and value !== n.value + while n != ø and value !== n.value n ← n.next end while if n = tail tail ← tail.previous tail.next ← ø return true - else if n = ø + else if n != ø n.previous.next ← n.next n.next.previous ← n.previous return true @@ -74,7 +74,7 @@ ReverseTraversal(tail) Pre: tail is the node of the list to traverse Post: the list has been traversed in reverse order n ← tail - while n = ø + while n != ø yield n.value n ← n.previous end while