Split a Circular Linked List into two halves

Splitting of a circular linked list into two parts. When linked list contains Even numbers of nodes. Then resulted of this, there are divided into two equal parts. head1 is contain first half nodes. And head2 contains second half nodes.

When linked list contain Odd numbers of nodes. Then head1 are containing of the one extra nodes. For example lets linked list contain 7 nodes in this situation first list contain 4 starting nodes and second list contain 3 last nodes pair.

Suppose we are inserted the following (1,2,3,4,5,6,7,8) node in a sequence.

Before split Circular Single linked list After split Circular Single linked list Set A After split Circular Single linked list Set B

Here given code implementation process.



Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved