Alternate Splitting of a given Linked List

Objective: Given a singly linked list, split it into two linked lists. These linked lists will contain the alternate nodes from the given linked list.


Alternate Splitting of a given Linked List


  • Make two pointers(headA and headB) and set it to head and next just to fix the headers for the new linked list.
  • Make Node currNode = head and Node t =
  • Do the traversal of the linked list.
  • Make next = and = (Splitting step).
  • Keep checking whether next!=null &&!=null.

Complete Code:



Top Companies Interview Questions..-

Google Microsoft Amazon Facebook more..

If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.

You may also like...

%d bloggers like this: