iruka
iruka copied to clipboard
Missed = sign on linkedlist implementation
In LinkedList implementation:
link
in line 116 I think this should be (i > list.size())
no equal needed as we already checked it in the previous if condition and we only want to make sure it's not bigger than list bound.
in line 120: I think we should loop until
j < i
not
j < i -1
,
for (let j = 0; j < i; j++) {
cur = cur.next
}
we need current pointer to hold the node before the ith node, so if i = 3 we want it to be the third node in the list so cur should point to i -1 that is 2
OR you missed = sign
for (let j = 0; j <= i -1; j++) {
cur = cur.next
}
and If you approve I can make PR with these changes PS: thank you so much I really enjoyed your videos :)