Skip to content

Fix singly linked list context error #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions questions/206md.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Reverse a singly linked list.
反轉一個連結陣列,需要一個指標來操作連結陣列,找出指標前的陣列並且將這個陣列加到目前指標節點的位置,這時候指標向前。

例如連結head[3,2,1]
1. 指標一開始放在[2]的位置,第一步將指標前的[3]從連結中切出來然後加到[2]的後面,連結陣列變成[3,2,1]。
1. 指標一開始放在[2]的位置,第一步將指標前的[3]從連結中切出來然後加到[2]的後面,連結陣列變成[2,3,1]。
2. 接下來指標向後移動到[1],切出前面的[2,3]應且加到[1]之後,連結陣列變成[1,2,3]
3. 指標在往後移,發現後面已經沒有節點,交換完成。

Expand Down Expand Up @@ -77,4 +77,4 @@ var reverseList = function(head) {
* 將prev接到temp後面,temp.next = prev; temp = [2,1]; cur = [3,4]
* 交換完成,temp變成新的prev,prev = temp, prev = [2,1]
* 重複以上步驟,值到反轉完成。
</pre>
</pre>