Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Data-Structures/Linked-List/SinglyLinkList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* SinglyLinkedList!!
* A linked list is implar to an array, it hold values.
* A linked list is similar to an array, it holds a list of values.
* However, links in a linked list do not have indexes. With
* a linked list you do not need to predetermine it's size as
* a linked list you do not need to predetermine its size as
* it grows and shrinks as it is edited. This is an example of
* a singly linked list.
*/
Expand All @@ -17,7 +17,7 @@ const LinkedList = (function () {
this.head = null
}

// class node (constructor)
// Class node (constructor)
// Creating Node with element's value
const Node = (function () {
function Node (element) {
Expand Down Expand Up @@ -46,12 +46,12 @@ const LinkedList = (function () {
} else {
let currentNode = this.head

// Loop till there is node present in the list
// Loop till there is a node present in the list
while (currentNode.next) {
currentNode = currentNode.next
}

// Adding node to the end of the list
// Adding node at the end of the list
currentNode.next = node
}
// Increment the length
Expand Down