mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
53781db275
When `n.next = tail` is true, we assign `n` to `tail` and `null` to `tail.next`, so `n.next` also becomes `null`. Then we assign `n.next.next` (because now `n.next` is `null`), we try to get `next` of `null`. That is why we should add an `else` case to check if `n.next` is not equal to `tail`. Co-authored-by: Oleksii Trekhleb <trehleb@gmail.com> |
||
---|---|---|
.. | ||
bloom-filter | ||
disjoint-set | ||
doubly-linked-list | ||
graph | ||
hash-table | ||
heap | ||
linked-list | ||
priority-queue | ||
queue | ||
stack | ||
tree | ||
trie |