Simplicity is the soul of efficiency. Austin Freeman

Circular list

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


Data structure Description

Circular linked list last node point to the first node of linked list. The single linked list last node point to null value which uses to identify the end of linked list. But, the circular linked list tail node point to the head node. A circularly linked list node looks exactly the same as a linear singly linked list.

Write a program to implement circular linked list. Once the item moved to tail, it overrides the head items.


Output

   					 
Insert items in the circular linked list: 41, 25, 63, 84
41->25->63->84

Insert item at 2nd position: 10
41->25->10->63->84

Insert item in the circular linked list: 53, 12
41->25->10->63->84->53->12

Delete the item in the position 1:25

Linked List items:
41->10->63->84->53->12

				    

Comments


No comments available!

Please login to add comments.