Given only a pointer to an arbitrary node in a singly-linked list, how would you delete that node? Are there any cases where this is impossible?
Sigiloso
OK, it bothered me that this was too simple so I looked around. You can do it, sort of. You copy the data from the next node to the target node, link the target node to the node after the next and then free the next node. Not the behavior you would expect, and dangerous if any pointers to the freed node are still around. IMHO it's this kind of trick programming that results in unstable and hard-to-maintain code, so if this is the correct answer, then you know what to expect from this organization. I'd love to learn of a better way.