SlideShare une entreprise Scribd logo
1  sur  16
LINKED LIST
Present by :
Sama MahammadAdil O.
Student
Computer science & engineering
INTRODUCTION
• Data structure :- A data structure is a logical representation of data and operation that can be
perform on the data.
There are two types of Data Structure :
1. Primitive Data Structure.
2. Non-Primitive Data Structure.
• 1. Primitive Data Structure :- Data which can directly operate by machine is known as
primitive data structure.
• These are the examples of primitive data structure Integer, Pointer, Char, Boolean etc.
• 2. Non-Primitive Data Structure :- Data which can not directly operate by machine but
need some algorithm to perform it’s task is known as non-primitive data structure.
• There are two types Non-Primitive Data Structure :
1. Linear Data Structure.
2. Non-Linear Data Structure.
 Linear Data Structure :- Linear data structure is in which all the data are arranged in
sequence.
These are the examples of Linear data structure Array, Stack, Queue, Linked List.
• Linked List :- Linked List is a linear data structure. It contains nodes. Each node contains two
parts, DATA part and LINK part.
DATA contains elements and
LINK contains address of another node.
LIMITATIONS OF ARRAYS
Arrays are simple to understand and elements of an array are easily accessible but have some
limitations.
Array have a fixed dimension.
Once the size of an array is decided it can not be change during execution.
Array elements always stored in continues memory locations.
Operations like insertion or deletion of the array elements are quite difficult.
To overcome this limitations we use Linked List.
LINKED LIST
• Linked list is a collection of elements called nodes.
• Each node contains two parts. They are DATA part and LINK part.
• The principal benefit of a linked list over a conventional array is that the list elements can easily
be inserted or removed without reallocation or reorganization of the entire structure because the
data items need not be stored contiguously in memory or on disk, while an array has to be
declared in the source code, before compiling and running the program.
• Linked lists allow insertion and removal of nodes at any point in the list.
NODE
Data Link
1000 2000 3000
[ LINKED LIST ]
• The above figure shows the example of marks obtained by different students can be stored in a
linked list.
• NULL indicates the end of the list.
25 2000 29 NULL26 3000
ADVANTAGES
• Linked lists are a dynamic data structure, allocating the needed memory while the program is
running.
• Insertion and deletion node operations are easily implemented in a linked list.
• Linear data structures such as stacks and queues are easily executed with a linked list.
• They can reduce access time and may expand in real time without memory overhead.
DISADVANTAGES
• They have a quite difficult to use more memory due to pointers requiring extra storage space.
• Nodes in a linked list must be read in order from the beginning as linked lists are
inherently sequential access.
• Nodes are stored in continuously, greatly increasing the time required to access individual
elements within the list.
• Difficulties arise in linked lists when it comes to reverse traversing. For instance, singly linked
lists are cumbersome to navigate backwards and while doubly linked lists are somewhat easier to
read, memory is wasted in allocating space for a back pointer.
OPERATIONS ON LINKED LIST
• The basic operations on linked list are :-
1. Creation
2. Insertion
3. Deletion
4. Traversing
5. Searching
6. Concatenation
7. Display
Creation :- Creation operation is used to create a new linked list.
Insertion :- Insertion operation is used to insert a new node in the linked list. A new node can
be inserted at the beginning of a linked list or at the end of linked list or at the specified position
of a linked list. If the list is empty, then the new node is inserted as a first node.
Deletion :- Deletion operation is used to delete a node from the linked list. It can be deleted
from the beginning of a linked list or from the end of linked list or from the specified position of
a linked list.
Traversing :- Traversing operation is a process of going through all the nodes of a linked list
from one end to the another end. If we start traversing from the very first node towards the last
node, it is called forward traversing. If we start traversing from the last node towards the first
node, it is called backward traversing.
Searching :- Searching operation is a process of accessing the desired node in the list. We start
searching node - by - node and compare the data of the node with the key.
Concatenation :- Concatenation operation is the process of appending the second list to the end
of the first list. When we concatenate two list, the resultant list become larger size.
Display :- Display operation is used to print each and every node’s information.
TYPES OF LINKED LIST
I. Single linked list.
II. Double linked list.
III. Circular linked list.
IV. Circular double linked list.
SINGLE LINKED LIST :-
• A single linked list is one in which all nodes are linked together in some sequential
manner.
• There is only one way traversal which is forward traversal.
• It is made of two parts Data and Link.
Data contains the element.
Link contains the address of next node.
• Last node link part contains null value which represents the end of the list. As shown in
below figure :
[ SINGLE LINKED LIST ]
Data Link Data NULLData Link
DOUBLE LINKED LIST :-
• A double linked list is one in which all nodes are linked together in some sequential
manner.
• There is two way traversal which are forward and backward traversals.
• It is made of three parts one Data and two Link.
Data contains the element.
First Link contains the address of previous node.
Second Link contains the address of next node.
• First node link and Last node link part contains null value which represents the end of
the list. As shown in below figure :
[ DOUBLE LINKED LIST ]
Prev
Link
DATA
NEXT
LINK
NULL DATA
NEXT
LINK
Prev
Link
DATA NULL
CIRCULAR LINKED LIST :-
• A circular linked list is one in which all nodes are linked together in some sequential
manner.
• There is only one way traversal in circular manner which is forward traversal.
• It is made of two parts Data and Link.
Data contains the element.
Link contains the address of next node.
• Last node link part contains the address of first node. As shown in below figure :
[ CIRCULAR LINKED LIST ]
Data Link Data LinkData Link
CIRCULAR DOUBLE LINKED LIST :-
• A circular double linked list is one in which all nodes are linked together in some sequential
manner.
• There is two way traversal in circular manner which are forward and backward traversals.
• It is made of three parts one Data and two Link.
Data contains the element.
First Link contains the address of previous node.
Second Link contains the address of next node.
• First node PREV link part contains the address of last node and Last node NEXT link part
contains the address of first node. As shown in below figure :
[ CIRCULAR DOUBLE LINKED LIST ]
Prev
Link
DATA
NEXT
LINK
PREV
LINK
DATA
NEXT
LINK
Prev
Link
DATA
NEXT
LINK

Contenu connexe

Tendances (20)

Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Linked list
Linked listLinked list
Linked list
 
Singly & Circular Linked list
Singly & Circular Linked listSingly & Circular Linked list
Singly & Circular Linked list
 
Quick Sort
Quick SortQuick Sort
Quick Sort
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
Linked lists
Linked listsLinked lists
Linked lists
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
b+ tree
b+ treeb+ tree
b+ tree
 
Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure Binary Heap Tree, Data Structure
Binary Heap Tree, Data Structure
 
Circular linked list
Circular linked list Circular linked list
Circular linked list
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
 
stack presentation
stack presentationstack presentation
stack presentation
 
Insertion in singly linked list
Insertion in singly linked listInsertion in singly linked list
Insertion in singly linked list
 
Topological Sorting
Topological SortingTopological Sorting
Topological Sorting
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Java Linked List Tutorial | Edureka
Java Linked List Tutorial |  EdurekaJava Linked List Tutorial |  Edureka
Java Linked List Tutorial | Edureka
 

Similaire à Linked list

linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
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 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
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked listLavanyaJ28
 
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
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.JAYANTAOJHA
 
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
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked ListAtiya Akhtar
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueSelvaraj Seerangan
 
DLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxDLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxMuwaffiqa
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptxpijuschal1
 
Introduction to linked lists
Introduction to linked listsIntroduction to linked lists
Introduction to linked listspooja kumari
 

Similaire à Linked list (20)

linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
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 (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).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
 
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 applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
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
Linked ListLinked List
Linked List
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.
 
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
 
Singly Linked List
Singly Linked ListSingly Linked List
Singly Linked List
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and Queue
 
2- link-list.ppt
2- link-list.ppt2- link-list.ppt
2- link-list.ppt
 
DLL DATA STRUCT.pptx
DLL DATA STRUCT.pptxDLL DATA STRUCT.pptx
DLL DATA STRUCT.pptx
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
Introduction to linked lists
Introduction to linked listsIntroduction to linked lists
Introduction to linked lists
 

Dernier

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
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
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
 
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
 
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
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
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
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 

Dernier (20)

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
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
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
 
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
 
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
 
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
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.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
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 

Linked list

  • 1. LINKED LIST Present by : Sama MahammadAdil O. Student Computer science & engineering
  • 2. INTRODUCTION • Data structure :- A data structure is a logical representation of data and operation that can be perform on the data. There are two types of Data Structure : 1. Primitive Data Structure. 2. Non-Primitive Data Structure. • 1. Primitive Data Structure :- Data which can directly operate by machine is known as primitive data structure. • These are the examples of primitive data structure Integer, Pointer, Char, Boolean etc.
  • 3. • 2. Non-Primitive Data Structure :- Data which can not directly operate by machine but need some algorithm to perform it’s task is known as non-primitive data structure. • There are two types Non-Primitive Data Structure : 1. Linear Data Structure. 2. Non-Linear Data Structure.  Linear Data Structure :- Linear data structure is in which all the data are arranged in sequence. These are the examples of Linear data structure Array, Stack, Queue, Linked List. • Linked List :- Linked List is a linear data structure. It contains nodes. Each node contains two parts, DATA part and LINK part. DATA contains elements and LINK contains address of another node.
  • 4. LIMITATIONS OF ARRAYS Arrays are simple to understand and elements of an array are easily accessible but have some limitations. Array have a fixed dimension. Once the size of an array is decided it can not be change during execution. Array elements always stored in continues memory locations. Operations like insertion or deletion of the array elements are quite difficult. To overcome this limitations we use Linked List.
  • 5. LINKED LIST • Linked list is a collection of elements called nodes. • Each node contains two parts. They are DATA part and LINK part. • The principal benefit of a linked list over a conventional array is that the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure because the data items need not be stored contiguously in memory or on disk, while an array has to be declared in the source code, before compiling and running the program. • Linked lists allow insertion and removal of nodes at any point in the list. NODE Data Link
  • 6. 1000 2000 3000 [ LINKED LIST ] • The above figure shows the example of marks obtained by different students can be stored in a linked list. • NULL indicates the end of the list. 25 2000 29 NULL26 3000
  • 7. ADVANTAGES • Linked lists are a dynamic data structure, allocating the needed memory while the program is running. • Insertion and deletion node operations are easily implemented in a linked list. • Linear data structures such as stacks and queues are easily executed with a linked list. • They can reduce access time and may expand in real time without memory overhead.
  • 8. DISADVANTAGES • They have a quite difficult to use more memory due to pointers requiring extra storage space. • Nodes in a linked list must be read in order from the beginning as linked lists are inherently sequential access. • Nodes are stored in continuously, greatly increasing the time required to access individual elements within the list. • Difficulties arise in linked lists when it comes to reverse traversing. For instance, singly linked lists are cumbersome to navigate backwards and while doubly linked lists are somewhat easier to read, memory is wasted in allocating space for a back pointer.
  • 9. OPERATIONS ON LINKED LIST • The basic operations on linked list are :- 1. Creation 2. Insertion 3. Deletion 4. Traversing 5. Searching 6. Concatenation 7. Display
  • 10. Creation :- Creation operation is used to create a new linked list. Insertion :- Insertion operation is used to insert a new node in the linked list. A new node can be inserted at the beginning of a linked list or at the end of linked list or at the specified position of a linked list. If the list is empty, then the new node is inserted as a first node. Deletion :- Deletion operation is used to delete a node from the linked list. It can be deleted from the beginning of a linked list or from the end of linked list or from the specified position of a linked list. Traversing :- Traversing operation is a process of going through all the nodes of a linked list from one end to the another end. If we start traversing from the very first node towards the last node, it is called forward traversing. If we start traversing from the last node towards the first node, it is called backward traversing.
  • 11. Searching :- Searching operation is a process of accessing the desired node in the list. We start searching node - by - node and compare the data of the node with the key. Concatenation :- Concatenation operation is the process of appending the second list to the end of the first list. When we concatenate two list, the resultant list become larger size. Display :- Display operation is used to print each and every node’s information.
  • 12. TYPES OF LINKED LIST I. Single linked list. II. Double linked list. III. Circular linked list. IV. Circular double linked list.
  • 13. SINGLE LINKED LIST :- • A single linked list is one in which all nodes are linked together in some sequential manner. • There is only one way traversal which is forward traversal. • It is made of two parts Data and Link. Data contains the element. Link contains the address of next node. • Last node link part contains null value which represents the end of the list. As shown in below figure : [ SINGLE LINKED LIST ] Data Link Data NULLData Link
  • 14. DOUBLE LINKED LIST :- • A double linked list is one in which all nodes are linked together in some sequential manner. • There is two way traversal which are forward and backward traversals. • It is made of three parts one Data and two Link. Data contains the element. First Link contains the address of previous node. Second Link contains the address of next node. • First node link and Last node link part contains null value which represents the end of the list. As shown in below figure : [ DOUBLE LINKED LIST ] Prev Link DATA NEXT LINK NULL DATA NEXT LINK Prev Link DATA NULL
  • 15. CIRCULAR LINKED LIST :- • A circular linked list is one in which all nodes are linked together in some sequential manner. • There is only one way traversal in circular manner which is forward traversal. • It is made of two parts Data and Link. Data contains the element. Link contains the address of next node. • Last node link part contains the address of first node. As shown in below figure : [ CIRCULAR LINKED LIST ] Data Link Data LinkData Link
  • 16. CIRCULAR DOUBLE LINKED LIST :- • A circular double linked list is one in which all nodes are linked together in some sequential manner. • There is two way traversal in circular manner which are forward and backward traversals. • It is made of three parts one Data and two Link. Data contains the element. First Link contains the address of previous node. Second Link contains the address of next node. • First node PREV link part contains the address of last node and Last node NEXT link part contains the address of first node. As shown in below figure : [ CIRCULAR DOUBLE LINKED LIST ] Prev Link DATA NEXT LINK PREV LINK DATA NEXT LINK Prev Link DATA NEXT LINK