Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 8

DATA STRUCTURES LAB

AALAB
LABREPORT
REPORTON
ON

CIRCULAR LINKED LIST


• M.VARUN REDDY - 237R1A05AZ

DEPARTMENT OF HUMANITIES AND SCIENCES

CMR TECHNICAL CAMPUS


UGC AUTONOMOUS
Approved by AICTE, New Delhi & JNTU Hyderabad
Kandlakoya, Medchal Road, Hyderabad - 501401
Introduction to Circular Linked List
• A circular linked list is a linked list where the last node points back to the first node, creating a circular structure. This data structure is
used for implementing advanced data storage and management techniques.

• The circular linked list is a linked list where all nodes are connected to form a circle. In a circular linked list, the first node and the last
node are connected to each other which forms a circle. There is no NULL at the end.
ALGORITHM:

 Create the node which is to be inserted, say NewNode

 Make the new node the last node last = NewNode.

 As it is the only node in the list, it will be the tail as well as head.

 Keeping the above point in mind, we will make the NewNode point to the last(itself) NewNode – >
next = last.

 By performing the above steps, the head and tail are being updated, as well as the NewNode is being
added to the empty list.
SOURCE CODE:
Enter 1 to Insert at Ending :-
OUTPUT: Enter 2 to Insert at Begining :-
Enter 3 to Insert at Position :-
Enter 4 to Delete at Ending :-
Enter 5 to Delete at Begining :-
Enter 6 to Delete at Position :-
Enter 7 to Display :-
Enter -1 to Exit :-
Enter your Choice :- 1
Enter the data:- 22
22 is Inserted at End

Enter your Choice :- 2


Enter the data:- 33
33 is Inserted at Begining

Enter your Choice :- 3


Enter the data & Position:- 44
2
44 is Inserted at Position 2

Enter your Choice :- 3


Enter the data & Position:- 55
2
55 is Inserted at Position 2

Enter your Choice :- 7


The Linked List is :- -793339168--33---793339104
-793339104--55---793339136
-793339136--44---793339200
-793339200--22---793339168

Enter your Choice :- 4


Value Deleted at End

Enter your Choice :- 5


Value Deleted at Begining

Enter your Choice :- 6


Enter Position to delete2
Value Deleted at Position 2

Enter your Choice :- 7


The Linked List is :- -793339104--55---793339104

Enter your Choice :- -1


Program Finished :-
CONCLUSION :

A circular linked list is a type of data structure where a loop is


maintained used by storing the first node of the list in the last node
of the linked list, thus named circular.

You might also like