Segregate even and odd nodes in a Linked List
Given a Linked List of integers, write a function to modify the linked list such that all even numbers appear before all the odd numbers in the modified linked list. Also, keep the order of even and odd numbers same.
- Create two list heads, one for even another for odd.
- Iterate given list from start to end
- Populate these list based on their types.
- At end, append odd list at end of even list
- return new head .
Latest Source Code:
11 15 20 5 10 20 10 11 15 5