Dsa
Linked List
Medium
Split and Merge Alternating Nodes in a Linked List
Write a function to split a linked list into two linked lists by alternating nodes, and then merge the two lists. Your program should read the linked list values from standard input and print the merged list where each node from the first and second lists is printed in alternating fashion.
### Input Format:
- The first line contains an integer n (1 ≤ n ≤ 1000), the number of values in the linked list.
- The next n lines each contain an integer value.
### Output Format:
- Print the merged linked list values, one on each line.
### Example:
Input:
6
1
2
3
4
5
6
Output:
1
4
2
5
3
6
Key concepts
linked_listalternating_nodesmerging
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now