SlideShare a Scribd company logo
INSERTION 
IN 
CIRCULAR DOUBLY 
LINKED LIST 
BY 
Roshan Chaudhary
CIRCULAR DOUBLY LINKED LIST 
• Doubly Circular linked list has both the properties of doubly 
linked list and circular linked list. 
• Two consecutive elements are linked by previous and next 
pointer and the last node points to first node by next pointer 
and also the previous pointer of the head node points to the 
tail node.
Node traversal from any direction is possible and also 
jumping from head to tail or from tail to head is only one 
operation: head pointer previous is tail and also tail pointer 
next is head.
INSERTING A NODE 
function insertAfter(Node node, Node newNode) 
newNode.next = node.next 
newNode.prev = node 
node.next.prev = newNode 
node.next = newNode 
This simple function inserts a node into a doubly-linked 
circularly linked list after a given element.
INSERTING A NODE (CONT.) 
function insertEnd(List list, Node node) 
if list.lastNode == null 
node.prev := node 
node.next := node 
else 
insertAfter(list.lastNode, node) 
list.lastNode := node 
To insert at the beginning.
Thank you

More Related Content

What's hot

Double Linked List (Algorithm)
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)
Huba Akhtar
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
Masud Parvaze
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
chauhankapil
 
LINKED LISTS
LINKED LISTSLINKED LISTS
LINKED LISTS
Dhrthi Nanda
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
shameen khan
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
Muhammad Hammad Waseem
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
Kevin Jadiya
 
Linkedlist
LinkedlistLinkedlist
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structureTushar Aneyrao
 
Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
DivyeshKumar Jagatiya
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
Vrushali Dhanokar
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
Tirthika Bandi
 
Linked list
Linked listLinked list
Linked list
Trupti Agrawal
 
Linked list
Linked list Linked list
Linked list
Arbind Mandal
 
Linked list
Linked listLinked list
Linked listVONI
 
Expression trees
Expression treesExpression trees
Expression trees
Salman Vadsarya
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
KristinaBorooah
 

What's hot (20)

AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Double Linked List (Algorithm)
Double Linked List (Algorithm)Double Linked List (Algorithm)
Double Linked List (Algorithm)
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
LINKED LISTS
LINKED LISTSLINKED LISTS
LINKED LISTS
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structure
 
Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
single linked list
single linked listsingle linked list
single linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked list Linked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Expression trees
Expression treesExpression trees
Expression trees
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
Linked list
Linked listLinked list
Linked list
 

Viewers also liked

Non Linear Data Structures
Non Linear Data StructuresNon Linear Data Structures
Non Linear Data Structures
Adarsh Patel
 
Linked lists
Linked listsLinked lists
Linked lists
SARITHA REDDY
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
Fahd Allebdi
 
Doubly Link List
Doubly Link ListDoubly Link List
Doubly Link List
Kashif Memon
 
Data structure
Data structureData structure
Data structureMohd Arif
 
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
Shail Nakum
 
Tower of Hanoi
Tower of HanoiTower of Hanoi
Tower of Hanoi
Ankit92Chitnavis
 
linked list
linked list linked list
linked list
Mohaimin Rahat
 
(Binary tree)
(Binary tree)(Binary tree)
(Binary tree)
almario1988
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
Muhammad Muzammal
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
anooppjoseph
 
Array in c language
Array in c languageArray in c language
Array in c languagehome
 
Linked list
Linked listLinked list
Linked list
akshat360
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)Arvind Devaraj
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its typesNavtar Sidhu Brar
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
student
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
Archie Jamwal
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
bca2010
 

Viewers also liked (18)

Non Linear Data Structures
Non Linear Data StructuresNon Linear Data Structures
Non Linear Data Structures
 
Linked lists
Linked listsLinked lists
Linked lists
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Doubly Link List
Doubly Link ListDoubly Link List
Doubly Link List
 
Data structure
Data structureData structure
Data structure
 
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
TYPES DATA STRUCTURES( LINEAR AND NON LINEAR)....
 
Tower of Hanoi
Tower of HanoiTower of Hanoi
Tower of Hanoi
 
linked list
linked list linked list
linked list
 
(Binary tree)
(Binary tree)(Binary tree)
(Binary tree)
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Queue data structure
Queue data structureQueue data structure
Queue data structure
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Linked list
Linked listLinked list
Linked list
 
Data structures (introduction)
 Data structures (introduction) Data structures (introduction)
Data structures (introduction)
 
Data structure and its types
Data structure and its typesData structure and its types
Data structure and its types
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 

Similar to Doubly circular linked list

linked-list.ppt
linked-list.pptlinked-list.ppt
linked-list.ppt
DikkySuryadiSKomMKom
 
Singly Linked List_Operations-Traversal.pptx
Singly Linked List_Operations-Traversal.pptxSingly Linked List_Operations-Traversal.pptx
Singly Linked List_Operations-Traversal.pptx
ssusera965f6
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
MeghaKulkarni27
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
rajveersingh643731
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
Zidny Nafan
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
sandeep54552
 
Lec3-Linked list.pptx
Lec3-Linked list.pptxLec3-Linked list.pptx
Lec3-Linked list.pptx
FaheemMahmood2
 
Linked list and its operations - Traversal
Linked list and its operations - TraversalLinked list and its operations - Traversal
Linked list and its operations - Traversal
kasthurimukila
 
Linked list
Linked listLinked list
Linked list
James Wong
 
Linked list
Linked listLinked list
Linked list
Hoang Nguyen
 
Linked list
Linked listLinked list
Linked list
Fraboni Ec
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
Keval Bhogayata
 
linked list using c
linked list using clinked list using c
linked list using c
Venkat Reddy
 
Linked list
Linked listLinked list
Linked list
maamir farooq
 
Lecture 4 data structures and algorithms
Lecture 4 data structures and algorithmsLecture 4 data structures and algorithms
Lecture 4 data structures and algorithmsAakash deep Singhal
 

Similar to Doubly circular linked list (20)

linked-list.ppt
linked-list.pptlinked-list.ppt
linked-list.ppt
 
Singly Linked List_Operations-Traversal.pptx
Singly Linked List_Operations-Traversal.pptxSingly Linked List_Operations-Traversal.pptx
Singly Linked List_Operations-Traversal.pptx
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
List data structure
List data structure List data structure
List data structure
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
 
Lec3-Linked list.pptx
Lec3-Linked list.pptxLec3-Linked list.pptx
Lec3-Linked list.pptx
 
Linked list and its operations - Traversal
Linked list and its operations - TraversalLinked list and its operations - Traversal
Linked list and its operations - Traversal
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Linked list
Linked listLinked list
Linked list
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
linked list using c
linked list using clinked list using c
linked list using c
 
Linked list
Linked listLinked list
Linked list
 
Lecture 4 data structures and algorithms
Lecture 4 data structures and algorithmsLecture 4 data structures and algorithms
Lecture 4 data structures and algorithms
 

More from Roshan Chaudhary

Overview of cryptography
Overview of cryptographyOverview of cryptography
Overview of cryptography
Roshan Chaudhary
 
Doubly circular linked list
Doubly circular linked listDoubly circular linked list
Doubly circular linked list
Roshan Chaudhary
 
Unipolar
UnipolarUnipolar
Software copyright
Software copyrightSoftware copyright
Software copyright
Roshan Chaudhary
 
Structure and function
Structure and functionStructure and function
Structure and function
Roshan Chaudhary
 
Effects Of ICT
Effects Of ICTEffects Of ICT
Effects Of ICT
Roshan Chaudhary
 
Pollution and Prevention
Pollution and PreventionPollution and Prevention
Pollution and Prevention
Roshan Chaudhary
 

More from Roshan Chaudhary (8)

Overview of cryptography
Overview of cryptographyOverview of cryptography
Overview of cryptography
 
Doubly circular linked list
Doubly circular linked listDoubly circular linked list
Doubly circular linked list
 
Unipolar
UnipolarUnipolar
Unipolar
 
Software copyright
Software copyrightSoftware copyright
Software copyright
 
Structure and function
Structure and functionStructure and function
Structure and function
 
Effects Of ICT
Effects Of ICTEffects Of ICT
Effects Of ICT
 
Pollution and Prevention
Pollution and PreventionPollution and Prevention
Pollution and Prevention
 
Hacking
HackingHacking
Hacking
 

Doubly circular linked list

  • 1. INSERTION IN CIRCULAR DOUBLY LINKED LIST BY Roshan Chaudhary
  • 2. CIRCULAR DOUBLY LINKED LIST • Doubly Circular linked list has both the properties of doubly linked list and circular linked list. • Two consecutive elements are linked by previous and next pointer and the last node points to first node by next pointer and also the previous pointer of the head node points to the tail node.
  • 3. Node traversal from any direction is possible and also jumping from head to tail or from tail to head is only one operation: head pointer previous is tail and also tail pointer next is head.
  • 4. INSERTING A NODE function insertAfter(Node node, Node newNode) newNode.next = node.next newNode.prev = node node.next.prev = newNode node.next = newNode This simple function inserts a node into a doubly-linked circularly linked list after a given element.
  • 5. INSERTING A NODE (CONT.) function insertEnd(List list, Node node) if list.lastNode == null node.prev := node node.next := node else insertAfter(list.lastNode, node) list.lastNode := node To insert at the beginning.