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)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Remove last node of the linked list
- Delete every Kth node from circular linked list
- Delete a Node from linked list without head pointer
- Find the second last node of a linked list in single traversal
- Replace each node with its Surpasser Count in Linked List
- How to remove the first character of string in PHP?
- Add and Remove vertex in Adjacency List representation of Graph
- Node.js | NPM (Node Package Manager)
- Check whether a node is leaf node or not for multiple queries
- Check if absolute difference of consecutive nodes is 1 in Linked List
- Find unique elements in linked list
- Check if linked list is sorted (Iterative and Recursive)
- Delete all Prime Nodes from a Singly Linked List
- Implement a stack using singly linked list
- Delete all the even nodes from a Doubly Linked List
- Product of all prime nodes in a Doubly Linked List
- Delete linked list nodes which have a greater value on left side
- Delete all the nodes from a doubly linked list that are smaller than a given value
- Sum of all nodes in a doubly linked list divisible by a given number K
- Maximum and Minimum element of a linked list which is divisible by a given number k
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.