Skip to content

Commit

Permalink
trekhleb#1020 updating insert at Head part
Browse files Browse the repository at this point in the history
  • Loading branch information
vrutikjadav committed Jan 23, 2024
1 parent 76617fa commit f4a2006
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/data-structures/linked-list/LinkedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit f4a2006

Please sign in to comment.