Redirecting to
NADOS

Segregate Even And Odd Nodes In A Linkedlist

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Given a singly linklist, modify the list such that all the even numbers appear before all the odd numbers in the modified list. The order of appearance of numbers within each segregation should be same as that in the original list.
Input Format
1->7->2->6->3->5->4->null
Output Format
2->6->4->1->7->3->5->null
Question Video
Constraints
0 <= N <= 10^6
Sample Input
4
0
6
7
5
Sample Output
0 6 7 5 


  • Asked in Companies
  • Related Topics






Video Solution

Code Solution

Run
 
Run
Id Name