bug(linked-list): `insert` method duplicates value of head in tail
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript
- 領域
- data
研究方向
Start in src/data-structures/linked-list/LinkedList.js around line 77 and reproduce the reported insert sequence. Inspect how head and tail are updated when inserting at the end; done means the tail references the final node rather than duplicating the head while preserving the shown list order.
由索引模型根據 Issue 內容生成。
描述
Hi, guys! Thank you for this awesome repository! The other day I found this problem
const list = new List();
list.insert(2, 0);
list.insert(3, 1);
list.insert(4, 2);
returns
{
"head": {
"data": 2,
"next": {
"data": 3,
"next": {
"data": 4,
"next": null
}
}
},
"tail": {
"data": 2,
"next": {
"data": 3,
"next": {
"data": 4,
"next": null
}
}
},
}
It solved if you add this code after line 77.
this.tail.next = newNode;
this.tail = newNode;
- 主要語言
- JavaScript
- 星號
- 197k
- 分支
- 31k
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
trekhleb/javascript-algorithms 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
trekhleb/javascript-algorithms#2225 ·
-
BinarySearchTreeNode removing可能已有人在做 @bbonch 於 243 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
trekhleb/javascript-algorithms#2102 · 1 則留言 ·
-
難度 4/5 3-5 天 新手友好度 45/100
trekhleb/javascript-algorithms#2221 · 4 則留言 ·
-
zh-TW translations missing — should contributors help complete?可能已有人在做 @anees4500 於 334 天前認領。 未關閉
難度 4/5 3-5 天 新手友好度 25/100
trekhleb/javascript-algorithms#2085 · 6 則留言 · 1 個 reaction ·
-
難度 3/5 1-2 天 新手友好度 35/100
trekhleb/javascript-algorithms#2065 · 1 則留言 ·
查看 trekhleb/javascript-algorithms 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
no-human-ai/no_human#659 ·
維護者通常 1 天內回覆
-
[BUG] Multi-day events show "Ended" while still in progress可能已有人在做 @tarunagnihotri534 今天認領。 未關閉bug
難度 2/5 1-3 小時 新手友好度 85/100
data-umbrella/du-event-board#231 · 2 則留言 ·
-
難度 1/5 1 小時以內 新手友好度 78/100
-
IO.get_env on Node truncates names at embedded NUL可能已有人在做 @Yi-111-a 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
HigherOrderCO/Bend#1449 · 1 則留言 ·
-
難度 1/5 1 小時以內 新手友好度 72/100
cryptpad/documentation#162 ·