Segregate Even And Odd Nodes In A Linkedlist
easy
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.
Constraints
0 <= N <= 10^6
Format
Input
1->7->2->6->3->5->4->null
Output
2->6->4->1->7->3->5->null
Example
Sample Input
4
0
6
7
5
Sample Output
0 6 7 5
Question Video