SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Data Structure
Link List
Unit-2
Linked List
• Linked List can be defined as collection of
objects called nodes that are randomly stored
in the memory.
• A node contains two fields i.e. data stored at
that particular address and the pointer which
contains the address of the next node in the
memory.
• The last node of the list contains pointer to
the null.
Each node holds its own data and the address of
the next node hence forming a chain like structure.
Linked Lists are used to create trees and graphs.
Types of Link List
Following are the types of linked list
• Singly Linked List.
• Doubly Linked List.
• Circular Linked List.
Insertion of node at particular position
Deleting node at Beginning of Link List
Deletion of node at the End of Link List
Deletion of node at the End of Link List
Deleting a particular node from Link List
Reversing the Link List
Reversing the Link List
Copying a Link List into other Link List
Merging Two Link List
Doubly Linked List
• A Doubly Linked List contains an extra memory
to store the address of the previous node,
together with the address of the next node and
data which are there in the singly linked list. So,
here we are storing the address of the next as
well as the previous nodes.
• The following is the structure of the node in the
Doubly Linked List(DLL):
Operations Performed on Two way Link List
• Traversing
• Searching
• Insertion
• Deletion
Traversing Two Way Link List
Two way link list can be traversed in both the directions i.e.
in forward direction as well as backward direction.
Searching Two Way Link List
• Traverse the list until the pointer becomes null. Keep
shifting pointer to its next and increasing by +1.
• Compare each element of the list with the item which
is to be searched.
• If the item matched with any node value then the
location of that value I will be returned from the
function else NULL is returned.
Insertion of node in Two way Link List
There are three cases while inserting node
• Insertion at the Beginning
• Insertion at the End
• Insertion at the Particular position
Inserting the node at the Beginning
Inserting the node at the End
Inserting the node at particular position
Deleting Node at Particular Position Two Way Link List
Deleting Last Node in Two Way Link List
Circular Link List
All Circular linked list is a list in which last node points
back to the first node instead of containing the Null pointer
in the next part of the last node.
Circular Singly Linked List
In a circular Singly linked list, the last node of the list
contains a pointer to the first node of the list. We can
have circular singly linked list as well as circular doubly
linked list.
We traverse a circular singly linked list until we reach
the same node where we started. The circular singly
liked list has no beginning and no ending. There is no
null value present in the next part of any of the nodes.
Operations on circular singly linked list
SN Operation Description
1 Insertion at beginning Adding a node in circular singly
linked list at the beginning.
2 Insertion at end Adding a node in circular singly
linked list at the end.
3 Deletion at beginning Removing a node in circular singly
linked list from beginning.
4 Deletion at end Removing a node in circular singly
linked list at the end.
5
Traversing
Visiting each element of the list at
least once in order to perform some
specific operation.
Circular Doubly Linked List
Circular doubly linked list is a more complexed type of
data structure in which a node contain pointers to its
previous node as well as the next node. Circular doubly
linked list doesn't contain NULL in any of the node. The
last node of the list contains the address of the first node
of the list. The first node of the list also contain address
of the last node in its previous pointer.
Operations on circular doubly linked list
:
SN Operation Description
1 Insertion at beginning Adding a node in circular doubly
linked list at the beginning.
2 Insertion at end Adding a node in circular doubly
linked list at the end.
3 Deletion at beginning Removing a node in circular doubly
linked list from beginning.
4 Deletion at end Removing a node in circular doubly
linked list at the end.
Advantages of a Circular linked list
• The list can be traversed from any node.
• Circular lists are the required data
structure when we want a list to be
accessed in a circle or loop.
• We can easily traverse to its previous
node in a circular linked list, which is not
possible in a singly linked list.
Disadvantages of Circular linked list
• If not traversed carefully, then we could
end up in an infinite loop because here
we don't have any NULL value to stop
the traversal.
• Operations in a circular linked list are
complex as compared to a singly linked
list and doubly linked list.
Link_List.pptx

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Tree traversal techniques
Tree traversal techniquesTree traversal techniques
Tree traversal techniques
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Heaps & priority queues
Heaps & priority queuesHeaps & priority queues
Heaps & priority queues
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
 
Tree Traversal
Tree TraversalTree Traversal
Tree Traversal
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Java Linked List Tutorial | Edureka
Java Linked List Tutorial |  EdurekaJava Linked List Tutorial |  Edureka
Java Linked List Tutorial | Edureka
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Data Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search TreeData Structure and Algorithms Binary Search Tree
Data Structure and Algorithms Binary Search Tree
 
Queues
QueuesQueues
Queues
 
Introduction to stack
Introduction to stackIntroduction to stack
Introduction to stack
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operations
 
Binary trees1
Binary trees1Binary trees1
Binary trees1
 
UNIT III NON LINEAR DATA STRUCTURES – TREES
UNIT III 	NON LINEAR DATA STRUCTURES – TREESUNIT III 	NON LINEAR DATA STRUCTURES – TREES
UNIT III NON LINEAR DATA STRUCTURES – TREES
 
Heap_Sort1.pptx
Heap_Sort1.pptxHeap_Sort1.pptx
Heap_Sort1.pptx
 
Introduction to data structure
Introduction to data structure Introduction to data structure
Introduction to data structure
 
Queue implementation
Queue implementationQueue implementation
Queue implementation
 
Queue in Data Structure
Queue in Data Structure Queue in Data Structure
Queue in Data Structure
 

Ähnlich wie Link_List.pptx

data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxSKUP1
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxLECO9
 
linked list using c
linked list using clinked list using c
linked list using cVenkat Reddy
 
Introduction to linked lists
Introduction to linked listsIntroduction to linked lists
Introduction to linked listspooja kumari
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfKamranAli649587
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxRameshaFernando2
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked listsAbdullah Al-hazmy
 
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
 

Ähnlich wie Link_List.pptx (20)

data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
 
DATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptxDATA STRUCTURES AND LINKED LISTS IN C.pptx
DATA STRUCTURES AND LINKED LISTS IN C.pptx
 
Linked list
Linked listLinked list
Linked list
 
linked list using c
linked list using clinked list using c
linked list using c
 
Introduction to linked lists
Introduction to linked listsIntroduction to linked lists
Introduction to linked lists
 
ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptx
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Linked lists
Linked listsLinked lists
Linked lists
 
Linked list
Linked listLinked list
Linked list
 
2- link-list.ppt
2- link-list.ppt2- link-list.ppt
2- link-list.ppt
 
Data structures2
Data structures2Data structures2
Data structures2
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
Linked List
Linked ListLinked List
Linked List
 
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
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Linked List
Linked ListLinked List
Linked List
 

Mehr von sandeep54552

Dijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxDijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxsandeep54552
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptxsandeep54552
 
Dijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptxDijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptxsandeep54552
 
File handling in c++
File handling in c++File handling in c++
File handling in c++sandeep54552
 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++sandeep54552
 
Inheritance in c++
Inheritance in c++ Inheritance in c++
Inheritance in c++ sandeep54552
 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++sandeep54552
 
C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introductionsandeep54552
 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligencesandeep54552
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jspsandeep54552
 
Enterprise java unit-2_chapter-3
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3sandeep54552
 

Mehr von sandeep54552 (20)

Dijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptxDijkstra Searching Algorithms Shortest.pptx
Dijkstra Searching Algorithms Shortest.pptx
 
E_R-Diagram (2).pptx
E_R-Diagram (2).pptxE_R-Diagram (2).pptx
E_R-Diagram (2).pptx
 
Dijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptxDijkstra Searching Algorithms.pptx
Dijkstra Searching Algorithms.pptx
 
Agents_AI.ppt
Agents_AI.pptAgents_AI.ppt
Agents_AI.ppt
 
Templates in c++
Templates in c++Templates in c++
Templates in c++
 
File handling in c++
File handling in c++File handling in c++
File handling in c++
 
Exception handling in c++
Exception handling in c++Exception handling in c++
Exception handling in c++
 
Inheritance in c++
Inheritance in c++ Inheritance in c++
Inheritance in c++
 
Constructor and Destructors in C++
Constructor and Destructors in C++Constructor and Destructors in C++
Constructor and Destructors in C++
 
C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introduction
 
Jsp tag library
Jsp tag libraryJsp tag library
Jsp tag library
 
Hill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligenceHill climbing algorithm in artificial intelligence
Hill climbing algorithm in artificial intelligence
 
Session bean
Session beanSession bean
Session bean
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
 
Bfs new
Bfs newBfs new
Bfs new
 
Bfs new
Bfs newBfs new
Bfs new
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
Enterprise java unit-3_chapter-1-jsp
Enterprise  java unit-3_chapter-1-jspEnterprise  java unit-3_chapter-1-jsp
Enterprise java unit-3_chapter-1-jsp
 
Enterprise java unit-2_chapter-3
Enterprise  java unit-2_chapter-3Enterprise  java unit-2_chapter-3
Enterprise java unit-2_chapter-3
 

Kürzlich hochgeladen

4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Kürzlich hochgeladen (20)

4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 

Link_List.pptx

  • 2. Linked List • Linked List can be defined as collection of objects called nodes that are randomly stored in the memory. • A node contains two fields i.e. data stored at that particular address and the pointer which contains the address of the next node in the memory. • The last node of the list contains pointer to the null.
  • 3. Each node holds its own data and the address of the next node hence forming a chain like structure. Linked Lists are used to create trees and graphs.
  • 4. Types of Link List Following are the types of linked list • Singly Linked List. • Doubly Linked List. • Circular Linked List.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. Insertion of node at particular position
  • 16.
  • 17.
  • 18. Deleting node at Beginning of Link List
  • 19.
  • 20. Deletion of node at the End of Link List
  • 21. Deletion of node at the End of Link List
  • 22.
  • 23. Deleting a particular node from Link List
  • 24.
  • 27. Copying a Link List into other Link List
  • 29. Doubly Linked List • A Doubly Linked List contains an extra memory to store the address of the previous node, together with the address of the next node and data which are there in the singly linked list. So, here we are storing the address of the next as well as the previous nodes. • The following is the structure of the node in the Doubly Linked List(DLL):
  • 30.
  • 31.
  • 32. Operations Performed on Two way Link List • Traversing • Searching • Insertion • Deletion
  • 33. Traversing Two Way Link List Two way link list can be traversed in both the directions i.e. in forward direction as well as backward direction.
  • 34. Searching Two Way Link List • Traverse the list until the pointer becomes null. Keep shifting pointer to its next and increasing by +1. • Compare each element of the list with the item which is to be searched. • If the item matched with any node value then the location of that value I will be returned from the function else NULL is returned.
  • 35. Insertion of node in Two way Link List There are three cases while inserting node • Insertion at the Beginning • Insertion at the End • Insertion at the Particular position
  • 36. Inserting the node at the Beginning
  • 37. Inserting the node at the End
  • 38. Inserting the node at particular position
  • 39.
  • 40.
  • 41. Deleting Node at Particular Position Two Way Link List
  • 42.
  • 43. Deleting Last Node in Two Way Link List
  • 44.
  • 45. Circular Link List All Circular linked list is a list in which last node points back to the first node instead of containing the Null pointer in the next part of the last node.
  • 46.
  • 47.
  • 48. Circular Singly Linked List In a circular Singly linked list, the last node of the list contains a pointer to the first node of the list. We can have circular singly linked list as well as circular doubly linked list. We traverse a circular singly linked list until we reach the same node where we started. The circular singly liked list has no beginning and no ending. There is no null value present in the next part of any of the nodes.
  • 49. Operations on circular singly linked list SN Operation Description 1 Insertion at beginning Adding a node in circular singly linked list at the beginning. 2 Insertion at end Adding a node in circular singly linked list at the end. 3 Deletion at beginning Removing a node in circular singly linked list from beginning. 4 Deletion at end Removing a node in circular singly linked list at the end. 5 Traversing Visiting each element of the list at least once in order to perform some specific operation.
  • 50. Circular Doubly Linked List Circular doubly linked list is a more complexed type of data structure in which a node contain pointers to its previous node as well as the next node. Circular doubly linked list doesn't contain NULL in any of the node. The last node of the list contains the address of the first node of the list. The first node of the list also contain address of the last node in its previous pointer.
  • 51. Operations on circular doubly linked list : SN Operation Description 1 Insertion at beginning Adding a node in circular doubly linked list at the beginning. 2 Insertion at end Adding a node in circular doubly linked list at the end. 3 Deletion at beginning Removing a node in circular doubly linked list from beginning. 4 Deletion at end Removing a node in circular doubly linked list at the end.
  • 52. Advantages of a Circular linked list • The list can be traversed from any node. • Circular lists are the required data structure when we want a list to be accessed in a circle or loop. • We can easily traverse to its previous node in a circular linked list, which is not possible in a singly linked list.
  • 53. Disadvantages of Circular linked list • If not traversed carefully, then we could end up in an infinite loop because here we don't have any NULL value to stop the traversal. • Operations in a circular linked list are complex as compared to a singly linked list and doubly linked list.