Singly Linked List Deletion in Middle


The steps to delete a node in the middle of the list are as follows:
  1. Traverse the list, searching to find if the current node's points to the next node that is the node to be deleted.
  2. Set that node's link to be a copy of the next nodes link.
Deletion in the middle of a Singly Linked List is O(n) as the entire list may have to be traversed.

Example:
Delete ruler from middle of list
  1. Traverse the List
    1. Is Head.link.node = ruler? -No
    2. Is paper.link.node = ruler? - No
    3. Is book.link.node = ruler? - Yes
  2. Set book.link = ruler.link
Ruler was deleted from the middle of the list, and this is the new layout for the Singly Linked List.