Matsushita's Blog

Delete a Node in the middle of singly Linked List

Problem

Implement an algorithm to delete a Node in the middle of singly Linked List, given only access to that Node

example: in following linked list case

①→②→③→④→⑤

I'm given only node③ and I have to delete node③.

Source Code