Linked list questions, part 3

so, this'll be the final part of my series of questions on linked lists: https://code.sololearn.com/cMOemv3GkDBy at line 155, withiin the deleteIndex method, what does "pre->next = cur->next;" do? from what i can tell, it is setting the next field of the previous node to the next field of the current node, but how does this correlate with deletion?

29th Nov 2017, 5:25 PM
X-1 - avatar
1 Réponse
+ 4
It should link the previous node with the next node, to skip the current node. --[pre|cur]--[cur|next]--[next|null] So it's skips the mid node, and it's not part of the Linked list anymore. --[pre|next]--[next|null]
29th Nov 2017, 5:50 PM
Boris Batinkov
Boris Batinkov - avatar