Split a Circular Linked List
Given a Circular Linked List split it into two halves circular lists.
If there are odd number of nodes in the given circular linked list then out of the resulting two halved lists, first list should have one node more than the second list. The resultant lists should also be circular lists and not linear lists.
- Find middle of circular linked list by Runner algorithm
- Set list2 head by
head2 = middle.next
- Set null for list1 tail node i.e.
middle.next = null
- Now it time set null for tail for list2 for this, iterate will
temp.next = head
- Set null for list2 tail node i.e.
temp.next = null
Latest Source Code:
1 2 3 4 5