This commit is contained in:
Marco Rocci 2024-04-25 08:17:18 +08:00 committed by GitHub
commit e5ed558f4d
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;