Given a linked list, the task is to remove the first node of the linked list and update the head pointer of the linked list.
Input : 1 -> 2 -> 3 -> 4 -> 5 -> NULL Output : 2 -> 3 -> 4 -> 5 -> NULL Input : 2 -> 4 -> 6 -> 8 -> 33 -> 67 -> NULL Output : 4 -> 6 -> 8 -> 33 -> 67 -> NULL
To remove first node, we need to make second node as head and delete memory allocated for first node.
23 11 29 12
Time complexity : O(1)
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Remove Nth node from end of the Linked List
- Remove last node of the linked list
- Remove every k-th node of the linked list
- Create new linked list from two given linked list with greater element at each node
- Swap Kth node from beginning with Kth node from end in a Doubly Linked List
- Swap Kth node from beginning with Kth node from end in a Linked List
- Program to remove vowels from Linked List
- Detect and Remove Loop in a Linked List
- Remove duplicates from an unsorted linked list
- Remove duplicates from a sorted linked list
- Remove all special characters from a singly Linked List
- Remove duplicates from a sorted linked list using recursion
- Remove all the Even Digit Sum Nodes from a Doubly Linked List
- Remove duplicates from an unsorted doubly linked list
- Remove duplicates from a sorted doubly linked list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.