diff --git a/src/data-structures/linked-list/LinkedList.js b/src/data-structures/linked-list/LinkedList.js index ba7d0e3e..4c8d32b2 100644 --- a/src/data-structures/linked-list/LinkedList.js +++ b/src/data-structures/linked-list/LinkedList.js @@ -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; } } }