This commit is contained in:
Marco Rocci 2024-07-17 10:38:16 +09:00 committed by GitHub
commit 2ef6929c93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,12 @@ export default class LinkedList {
}
// Attach new node to the end of linked list.
let current = this.head;
while (current.next !== null) {
current = current.next;
}
current.next = newNode;
this.tail.next = newNode;
this.tail = newNode;