Problem Solving: Implement an algorithm to delete a node in the middle of a single linked list, given only access to that node
Problem Implement an algorithm to delete a node in the middle of a single linked list, given only access to that node EXAMPLE Input: the node ‘c’ from the linked list a->b->c->d->e Result: nothing is returned, but the new linked list looks like a->b->d->e Solution The question is a bit confusing. I first though its asking to remove the middle element of the list and I thought we have the full list. But later I think I got it. As per my understanding is we clear the node which we have access only and it will be somewhere in the middle. What we can do, we can migrate the data from next one to this one and set next to next of next. Code https://github.com/tapos/ctci/tree/master/src/p23