#1020 updating insert at Head part

This commit is contained in:
vrutikjadav 2024-01-23 12:06:36 +05:30
parent 76617fa83a
commit f4a2006e60

View File

@ -80,8 +80,10 @@ export default class LinkedList {
this.tail.next = newNode; this.tail.next = newNode;
this.tail = newNode; this.tail = newNode;
} else { } else {
this.head = newNode; // this.head = newNode;
this.tail = newNode; // this.tail = newNode;
newNode.next = this.head;
newNode = this.head;
} }
} }
} }