mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
#1020 updating insert at Head part
This commit is contained in:
parent
76617fa83a
commit
f4a2006e60
@ -80,8 +80,10 @@ export default class LinkedList {
|
||||
this.tail.next = newNode;
|
||||
this.tail = newNode;
|
||||
} else {
|
||||
this.head = newNode;
|
||||
this.tail = newNode;
|
||||
// this.head = newNode;
|
||||
// this.tail = newNode;
|
||||
newNode.next = this.head;
|
||||
newNode = this.head;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user