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(n)
- Remove last node of the linked list
- Remove every k-th node of the linked list
- Swap Kth node from beginning with Kth node from end in a Linked List
- Linked List | Set 3 (Deleting a node)
- Linked List | Set 2 (Inserting a node)
- Program for n'th node from the end of a Linked List
- Squareroot(n)-th node in a Linked List
- Delete every Kth node from circular linked list
- Reverse each word in a linked list node
- Delete a Linked List node at a given position
- Insert node into the middle of the linked list
- Find first node of loop in a linked list
- Sum of nodes in a linked list which are greater than next node
- Delete a node in a Doubly Linked List
- Find modular node in a 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.
Improved By : VishalBachchas