question

Given only a pointer to the middle node of a singly linked list, devise an algorithm delete that node.

Play with the next pointers and perhaps moving data around.

Because we cannot change the previous node's pointer (singly linked list and so we
can only move forward), a deletion is a bit more complex.
Suppose we have the following linked list:

node(n - 1) -> node(n) -> node(n + 1)

To delete node(n) first copy the data from node(n + 1) into node(n). Then copy the next pointer from node(n + 1) into node(n)'s next pointer.

node(n - 1) -> node(n) -> node(n + 1)

To delete node(n) first copy the data from node(n + 1) into node(n). Then copy the next pointer from node(n + 1) into node(n)'s next pointer.