A linked list is a linear collection of data elements, in which each node points to the next node. Unlike an array, it doesn’t have upper limit and hence extremely useful.
The task is to access value of each node of linked list and reverse them.
Input : 56 87 12 49 35 Output :65 78 21 94 53 Input : 128 87 12433 491 33 Output :821 78 33421 194 33
The task can be accomplished as:
- Linearly traverse each node of the singly linked list.
- Reverse the value of each node.
- Store the reversed value in the current node.
List before reversing individual data item 56 87 12 49 35 List after reversing individual data item 65 78 21 94 53
- Reverse alternate K nodes in a Singly Linked List
- Select a Random Node from a Singly Linked List
- Given only a pointer to a node to be deleted in a singly linked list, how do you delete it?
- Update adjacent nodes if the current node is zero in a Singly Linked List
- Given only a pointer/reference to a node to be deleted in a singly linked list, how do you delete it?
- Recursive selection sort for singly linked list | Swapping node links
- Reverse each word in a linked list node
- Program for n'th node from the end of a Linked List
- Program to reverse a linked list using Stack
- Java Program for Reverse a linked list
- Convert singly linked list into circular linked list
- Difference between Singly linked list and Doubly linked list
- Convert Singly Linked List to XOR Linked List
- Create new linked list from two given linked list with greater element at each node
- Sum of the nodes of a Singly 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.