Given a linked list, split the linked list into two with alternate nodes.
Input : 1 2 3 4 5 6 7 Output : 1 3 5 7 2 4 6 Input : 1 4 5 6 Output : 1 5 4 6
We have discussed Iterative splitting of linked list.
The idea is to begin from two nodes first and second. Let us call these nodes as ‘a’ and ‘b’. We recurs
a : 1 3 5 7 b : 2 4 6
- Alternating split of a given Singly Linked List | Set 1
- Recursive Approach to find nth node from the end in the linked list
- Modify contents of Linked List - Recursive approach
- Print the last k nodes of the linked list in reverse order | Recursive approach
- Sort a linked list that is sorted alternating ascending and descending orders?
- A Programmer's approach of looking at Array vs. Linked List
- Split a Circular Linked List into two halves
- Construct a linked list from 2D matrix (Iterative Approach)
- Recursive insertion and traversal linked list
- Reverse a Linked List in groups of given size (Iterative Approach)
- Recursive function to delete k-th node from linked list
- Check if linked list is sorted (Iterative and Recursive)
- Search an element in a Linked List (Iterative and Recursive)
- Find Length of a Linked List (Iterative and Recursive)
- Iterative approach for removing middle points in a linked list of line segements
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.