Skip to content

Commit fefd4d4

Browse files
committed
corrected styling and spelling mistake
1 parent 96be45f commit fefd4d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Data-Structures/Linked-List/SinglyLinkedList.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class LinkedList {
4444
}
4545

4646
// Returns the tail
47-
tail() {
47+
tail () {
4848
return this.tailNode?.data || null
4949
}
5050

@@ -68,7 +68,7 @@ class LinkedList {
6868
}
6969

7070
// add a node at first it to linklist
71-
addFirst(element) {
71+
addFirst (element) {
7272
const node = new Node(element)
7373
// Check if its the first element
7474
if (this.headNode === null) {
@@ -130,7 +130,7 @@ class LinkedList {
130130
if (this.tailNode.data === element) {
131131
return this.removeLast()
132132
}
133-
// Check whch node is the node to remove
133+
// Check which node is the node to remove
134134
while (currentNode.next) {
135135
if (currentNode.next.data === element) {
136136
removedNode = currentNode.next
@@ -144,7 +144,7 @@ class LinkedList {
144144
}
145145

146146
// Returns the index of the element passed as param otherwise -1
147-
indexOf(element) {
147+
indexOf (element) {
148148
if (this.isEmpty()) return -1
149149
let { currentNode, currentIndex } = this.initiateNodeAndIndex()
150150
while (currentNode) {
@@ -258,7 +258,7 @@ class LinkedList {
258258
}
259259
current.next = this.headNode
260260
tail = current
261-
k = k % count
261+
k %= count
262262
while (count - k > 0) {
263263
tail = tail.next
264264
count--

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy