Previous Article: Implementation of Singly Linked List.
Next Article: Reversing a Singly Linked List
Deletion of a Node from a Singly Linked List
Similar to insertion we have three cases for deleting a Node from a Singly Linked List.
- Deleting First Node in Singly Linked List
To complete deletion of firstNode in the list we have to change Head pointing to Next of firstNode.
firstNode = Head Head = firstNode->Next free firstNodeComplexity:
Time Complexity: O(1)
Space Complexity: O(1)