On two occasions I have been asked [by members of Parliament]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. Charles Babbage

Split a Circular Linked List into two halves

Language Java | Level Intermediate | Category Data structure | September 5, 2015 11:03 pm


Data structure Description

Circular linked list is a linked list in which the head node previous pointer points to the tail node.

Write a program to split the circular linked list into two halves linked list. Two lists should have split with equal size. If the list has an odd number of elements, split with two nearly half lists.


Output

   					 

Create circular linked list which head pointer next node point to tail node of the list
Display circular linked list: 1->2->3->4->5->6->7
Split the circular list 
Display first list: 1->2->3->4
Display second list: 5->6->7

				    

Comments


No comments available!

Please login to add comments.