Singly Linked List Deletion at End


The steps to delete a node at the end of the list are as follows:
  1. Traverse the list, searching to find if the current node's points to the next node that has its link set to null.
  2. Set that node's link to now be null.
Deletion at the end of a Singly Linked List is O(n) as the entire list had to be traversed.

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