From a72fda4dfd11d52f7bab13a897010552978f0106 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Thu, 5 Jul 2018 15:33:39 +0300 Subject: [PATCH] Minor code style fixes for DoublyLinkedList. --- .../doubly-linked-list/DoublyLinkedList.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/data-structures/doubly-linked-list/DoublyLinkedList.js b/src/data-structures/doubly-linked-list/DoublyLinkedList.js index 5eaacc24..7b3681c1 100644 --- a/src/data-structures/doubly-linked-list/DoublyLinkedList.js +++ b/src/data-structures/doubly-linked-list/DoublyLinkedList.js @@ -23,9 +23,9 @@ export default class DoublyLinkedList { // Make new node to be a head. const newNode = new DoublyLinkedListNode(value, this.head); - // If there is head, then it won't be head anymore - // Therefore, make its previous reference to be new node (new head) - // Then mark the new node as head + // If there is head, then it won't be head anymore. + // Therefore, make its previous reference to be new node (new head). + // Then mark the new node as head. if (this.head) { this.head.previous = newNode; } @@ -57,7 +57,7 @@ export default class DoublyLinkedList { // Attach new node to the end of linked list. this.tail.next = newNode; - // Attach current tail to the new node's previous reference + // Attach current tail to the new node's previous reference. newNode.previous = this.tail; // Set new node to be the tail of linked list. @@ -83,10 +83,10 @@ export default class DoublyLinkedList { deletedNode = currentNode; if (deletedNode === this.head) { - // set head to second node, which will become new head + // Set head to second node, which will become new head. this.head = deletedNode.next; - // set new head's previous to null + // Set new head's previous to null if (this.head) { this.head.previous = null; }