SlideShare a Scribd company logo
LinkedList
LinkedList
• A linked list is a non-primitive linear data structure, in which the
elements are not stored at contiguous memory locations.
• It is a collection of items and each item is represented by a node.
Cont…
• Each node will contain at least two field.
• First field will contain information of element is called data and this
field also called data field.
• Second field is called pointer field and it will contain the address of
next node.
Cont…
• Here, we will have a START pointer that will contain the address of
first node of a linkedlist.
Types of LinkedList
• There are different types of linkedlist.
• Single LinkedList (Linear LinkedList)
• Circular Single LinkedList
• Doubly LinkedList
• Circular Doubly LinkedList
1. Single LinkedList (Linear LinkedList)
• In it, each node will contain 2 fields.
• First field will contain the information of the element is called data
field and second field contain the address of next node is called
pointer field.
• Pointer field of last node will contain NULL value.
Example of Single LinkedList
100
START
info next
100
info next
200
info next
300
10 200 20 300 30 NULL
Disadvantage of Single Linked List
• In it, we can not access previous node from the current node.
• This problem can be removed in doubly LinkedList.
Operations on Linked List
• Following are important operations on Linked List
• Inserting Element in a linked list
• Traversing/Processing/Printing a Linked List
• Deleting Element from a linked list
• Count number of elements in a linked list
• Search an element in a linked list
Operations on Linked List
• Following are important operations on Linked List
• Insert
• Traverse
• Delete
• Count
• Search
Traverse
• Traversal of Singly Linked List
• Traversal in a linked list means visiting each node and performing
operations like printing or processing data.
Traverse
• Step-by-step approach:
1. Initialize a pointer (current) to the head of the list.
2. Loop through the list using a while loop until current becomes NULL.
3. Process each node (e.g., print its data).
4. Move to the next node by updating current = current->next.
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
Search
• Searching in Singly Linked List
• Searching in a Singly Linked List refers to the process of looking for a
specific element or value within the elements of the linked list.
Search
• Step-by-step approach:
1. Start from the head of the linked list.
2. Check each node’s data:
3. If it matches the target value, return true (element found).
4. Otherwise, move to the next node.
5. Repeat until the end (NULL) is reached.
6. If no match is found, return false.
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
Count/Length
• Length of Singly Linked List
• Finding the length of a Singly Linked List means counting the total
number of nodes.
Count/Length
• Step-by-step approach:
• Initialize a counter (length = 0).
• Start from the head, assign it to current.
• Traverse the list:
• Increment length for each node.
• Move to the next node (current = current->next).
• Return the final length when current becomes NULL.
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
Delete
• Deletion in Singly Linked List
• Deleting a node in a Linked List is an important operation and can be
done in three main ways:
• removing the first node,
• removing a node in the middle,
• or removing the last node.
Delete
• There are different scenarios for deletion:
• Deletion at the Beginning of Singly Linked List:
• Deletion at the End of Singly Linked List:
• Deletion at a Specific Position of Singly Linked List:
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
Algorithm
Algorithm is to delete a node containing a specified key
Purpose:
The purpose of this algorithm is to delete a node containing a specified key value
from a singly linked list.
The algorithm traverses the list to locate the node with the target value and removes
it while maintaining the integrity of the linked list.
Problem Statement:
Given a singly linked list and a key value, delete the node that contains the specified
key.
Update the list and ensure all pointers are correctly adjusted.
Input:
A pointer to the head of the linked list.
An integer key that represents the value of the node to be deleted.
Output:
The modified linked list after deleting the node with the given key.
If the key is not found, the list remains unchanged.
Constraints:
The list may be empty.
The key may be located anywhere in the list.
The node to be deleted may be the first, middle, or last node.
Algorithm is to delete a node containing a specified key
Algorithm:
Step 1: Start
Define a function deleteNode(head, key) that takes the head of the list
and the key as arguments.
Step 2: Check if List is Empty
If head == null, print "List is empty" and return head.
Step 3: Check if Head Node Holds the Key
Check if the head node contains the key:
If head.data == key, update the head pointer to the next node using:
head = head.next
Return the updated list.
Algorithm is to delete a node containing a specified key
Step 4: Initialize Pointers
Create two pointers:
prev → Points to null initially.
current → Points to head.
Step 5: Traverse the List to Find the Key
Loop through the list until current != null:
If current.data == key:
Update the next pointer of the previous node:
prev.next = current.next
Break the loop and delete the node.
Else:
Move prev to current.
Move current to current.next.
Algorithm is to delete a node containing a specified key
Algorithm is to delete a node containing a specified key
Step 6: Check if Key was Found
If the key was not found (current == null), print "Key not found" and
return head.
Step 7: Return Updated List
Return the modified list with the node deleted.
Algorithm is to delete a node containing a specified key
Pseudocode:
Function deleteNode(head, key):
If head == NULL:
Print "List is empty"
Return head
If head.data == key:
head = head.next
Return head
prev ← NULL
current ← head
While current != NULL:
If current.data == key:
prev.next = current.next
Break
prev ← current
current ← current.next
If current == NULL:
Print "Key not found"
Return head
Insert
• Insertion is a fundamental operation in linked lists that involves adding
a new node to the list. There are several scenarios for insertion:
• Insertion at the Beginning of Singly Linked List:
• Insertion at the End of Singly Linked List:
• Insertion at a Specific Position of the Singly Linked List:
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures
Algorithm to Insert node
• The purpose of this algorithm is to insert a node with a given key
value at a specified position in a singly linked list. The node can be
inserted:
• At the beginning.
• At a specific position.
• At the end if the position exceeds the length of the list.
Input:
•A pointer to the head of the linked list.
•An integer key representing the value to be inserted.
•An integer position representing the 0-based index where
the node should be inserted.
Algorithm to Insert node in a Linked List
Output:
•The modified linked list after inserting the new node at the specified
position.
•If the position is invalid, the list remains unchanged, and an appropriate
message is printed.
Algorithm to Insert node in a Linked List
Constraints:
The list may be empty.
If position == 0, the node is inserted at the beginning.
If position > length of list, the node is inserted at the end.
Position cannot be negative.
Algorithm to Insert node in a Linked List
Step 1: Start
Define a function insertAtPosition(head, key, position) that takes the head of the
list, the key, and the position as arguments.
Step 2: Check for Invalid Position
If position < 0, print:
"Invalid position"
Return head.
Step 3: Create a New Node
Allocate memory for a new node.
Set:
newNode.data = key
newNode.next = NULL
Algorithm to Insert node in a Linked List
Step 5: Traverse the List to Find the Position
Create a pointer temp and initialize it to head.
Initialize a counter count = 0.
Traverse the list while temp != NULL and count < position - 1:
Move temp to temp.next.
Increment count.
Step 6: Check if Position is Out of Bounds
If temp == NULL and position > count + 1
print: "Position out of bounds, inserting at the end"
Traverse to the last node and insert the new node at the end.
Algorithm to Insert node in a Linked List
Step 7: Insert Node at Desired Position
If temp != NULL:
Update pointers to insert newNode:
newNode.next = temp.next
temp.next = newNode
Step 8: Return Updated List
Return the modified list after inserting the node.
Pseudocode:
Function insertAtPosition(head, key, position):
If position < 0:
Print "Invalid position"
Return head
Create newNode
newNode.data = key
newNode.next = NULL
If position == 0:
newNode.next = head
head = newNode
Return head
temp ← head
count ← 0
While temp != NULL AND count < position - 1:
temp ← temp.next
count ← count + 1
If temp == NULL:
Print “Inserting at the end"
temp ← head
While temp.next != NULL:
temp ← temp.next
temp.next = newNode
Return head
newNode.next = temp.next
temp.next = newNode
Return head
2. Circular Single LinkedList
• A single linkedlist can be made as circular single linkedlist in which
pointer field of last node will contain the address of first node.
Example of Circular Single LinkedList
100
START
info next
100
info next
200
info next
300
10 200 20 300 30 100
Advantage of Circular Single LinkedList
• In it, from last node we can move directly to the first node of circular
single LinkedList because pointer field of last node will contain the
address of first node.
Disadvantage of Circular Single Linked List
• In it, we can not access previous node from the current node.
• This problem can be removed in doubly LinkedList.
3. Doubly LinkedList
• It is also called Two-way linked list.
• Here each node will contain 3 fields. First field will contain the
address of previous node. It is also called previous pointer.
• Second field will contain the information of element is called data
field.
Cont…
• Third field will contain the address of next node is called next pointer.
Example of Doubly LinkedList
100
prev info next
NULL 200
10
200
prev info next
100 300
20
100
300
prev info next
200 NULL
30
START
Advantage of Doubly LinkedList
• In it, we can we can move previous and next node from the current
node because every node contain the address of previous and next
node.
Disadvantage of Doubly LinkedList
• Doubly LinkedList require more memory than single linkedlist
because every node of it contain 3 field. Two pointer and one data
field.
4. Circular Doubly LinkedList
• A doubly linkedlist can be made as circular doubly linkedlist in which
the previous pointer of first node will contain the address of last node
and next pointer of last node will contain the address of first node.
Example of Circular Doubly LinkedList
100
prev info next
300 200
10
200
prev info next
100 300
20
100
300
prev info next
200 100
30
START
Advantage of Circular Doubly LinkedList
• In it, from first node we can move directly to the last node because
previous pointer of first node will contain the address of last node.
• In it, from last node we can move directly to the first node because
next pointer of last node will contain the address of first node.
Advantage of LinkedList
• LinkedList is a dynamic data structure i.e they can increase or decrease
a node during the execution of a program.
• The size is not fixed.
• Data can store non-continuous memory block.
Cont…
• Insertion and deletion of a node are easier and efficient.
Disadvantage of LinkedList
• More Memory Required: In the linked list there is an special field
called pointer field which hold the address of next node so linked list
requires extra space.
• Accessing to random data item is time consuming.
Syntax to create a node of LinkedList
struct structure name
{
datatype variablename;
struct structure name *pointervariablename;
};
Example:
struct node
{
int info;
struct node *next;
};
Cont…
Example:
struct node
{
int info;
struct node *next;
};
References
• Text
• https://www.geeksforgeeks.org/singly-linked-list-tutorial/
• https://www.geeksforgeeks.org/linked-list-data-structure/?ref=lbp
•

More Related Content

PPTX
Linked List Representation of a Linked List.pptx
PPTX
Datastucture-Unit 4-Linked List Presentation.pptx
PPTX
1.3 Linked List.pptx
PPTX
Linked list and its operations - Traversal
PDF
Linked Lists.pdf
PPTX
Linked list
PPTX
Linked List Presentation in data structurepptx
PPTX
Lecture ............ 3 - Linked Lists.pptx
Linked List Representation of a Linked List.pptx
Datastucture-Unit 4-Linked List Presentation.pptx
1.3 Linked List.pptx
Linked list and its operations - Traversal
Linked Lists.pdf
Linked list
Linked List Presentation in data structurepptx
Lecture ............ 3 - Linked Lists.pptx

Similar to LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures (20)

PPTX
Linked List - Insertion & Deletion
PPT
Operations on linked list
PDF
Chapter 3 Linkedlist Data Structure .pdf
PDF
Singly linked list
PPTX
data structures and applications power p
PPTX
Circular Linked List in Data Structures Design
PPTX
dokumen.tips_linked-list-ppt-5584a44be6115.pptx
PPTX
LEC_4,5_linked_list.pptx this is Good for data structure
PPTX
LEC_4,5_linked_list.pptx for single and double linked list
PDF
ds-lecture-4-171012041008 (1).pdf
PDF
DS Module 03.pdf
PPT
lecture four of data structures :Linked List-ds.ppt
PPTX
Linked list
DOCX
Linked list.docx
PPTX
Linked List
PPTX
linked list in data structure
PPTX
VCE Unit 02 (1).pptx
PDF
linkrd_list.pdf
PPTX
single linked list
PPT
Link list using array in Data structure amd algorithms
Linked List - Insertion & Deletion
Operations on linked list
Chapter 3 Linkedlist Data Structure .pdf
Singly linked list
data structures and applications power p
Circular Linked List in Data Structures Design
dokumen.tips_linked-list-ppt-5584a44be6115.pptx
LEC_4,5_linked_list.pptx this is Good for data structure
LEC_4,5_linked_list.pptx for single and double linked list
ds-lecture-4-171012041008 (1).pdf
DS Module 03.pdf
lecture four of data structures :Linked List-ds.ppt
Linked list
Linked list.docx
Linked List
linked list in data structure
VCE Unit 02 (1).pptx
linkrd_list.pdf
single linked list
Link list using array in Data structure amd algorithms
Ad

Recently uploaded (20)

PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Digital Logic Computer Design lecture notes
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
composite construction of structures.pdf
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Mechanical Engineering MATERIALS Selection
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPT
Project quality management in manufacturing
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Welding lecture in detail for understanding
PPTX
Geodesy 1.pptx...............................................
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Arduino robotics embedded978-1-4302-3184-4.pdf
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Digital Logic Computer Design lecture notes
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
composite construction of structures.pdf
UNIT-1 - COAL BASED THERMAL POWER PLANTS
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mechanical Engineering MATERIALS Selection
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Project quality management in manufacturing
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Operating System & Kernel Study Guide-1 - converted.pdf
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Welding lecture in detail for understanding
Geodesy 1.pptx...............................................
Lesson 3_Tessellation.pptx finite Mathematics
Ad

LinkedList-VJ-V2.pptx Analysis of Algorithms and Data Structures

  • 2. LinkedList • A linked list is a non-primitive linear data structure, in which the elements are not stored at contiguous memory locations. • It is a collection of items and each item is represented by a node.
  • 3. Cont… • Each node will contain at least two field. • First field will contain information of element is called data and this field also called data field. • Second field is called pointer field and it will contain the address of next node.
  • 4. Cont… • Here, we will have a START pointer that will contain the address of first node of a linkedlist.
  • 5. Types of LinkedList • There are different types of linkedlist. • Single LinkedList (Linear LinkedList) • Circular Single LinkedList • Doubly LinkedList • Circular Doubly LinkedList
  • 6. 1. Single LinkedList (Linear LinkedList) • In it, each node will contain 2 fields. • First field will contain the information of the element is called data field and second field contain the address of next node is called pointer field. • Pointer field of last node will contain NULL value.
  • 7. Example of Single LinkedList 100 START info next 100 info next 200 info next 300 10 200 20 300 30 NULL
  • 8. Disadvantage of Single Linked List • In it, we can not access previous node from the current node. • This problem can be removed in doubly LinkedList.
  • 9. Operations on Linked List • Following are important operations on Linked List • Inserting Element in a linked list • Traversing/Processing/Printing a Linked List • Deleting Element from a linked list • Count number of elements in a linked list • Search an element in a linked list
  • 10. Operations on Linked List • Following are important operations on Linked List • Insert • Traverse • Delete • Count • Search
  • 11. Traverse • Traversal of Singly Linked List • Traversal in a linked list means visiting each node and performing operations like printing or processing data.
  • 12. Traverse • Step-by-step approach: 1. Initialize a pointer (current) to the head of the list. 2. Loop through the list using a while loop until current becomes NULL. 3. Process each node (e.g., print its data). 4. Move to the next node by updating current = current->next.
  • 14. Search • Searching in Singly Linked List • Searching in a Singly Linked List refers to the process of looking for a specific element or value within the elements of the linked list.
  • 15. Search • Step-by-step approach: 1. Start from the head of the linked list. 2. Check each node’s data: 3. If it matches the target value, return true (element found). 4. Otherwise, move to the next node. 5. Repeat until the end (NULL) is reached. 6. If no match is found, return false.
  • 17. Count/Length • Length of Singly Linked List • Finding the length of a Singly Linked List means counting the total number of nodes.
  • 18. Count/Length • Step-by-step approach: • Initialize a counter (length = 0). • Start from the head, assign it to current. • Traverse the list: • Increment length for each node. • Move to the next node (current = current->next). • Return the final length when current becomes NULL.
  • 20. Delete • Deletion in Singly Linked List • Deleting a node in a Linked List is an important operation and can be done in three main ways: • removing the first node, • removing a node in the middle, • or removing the last node.
  • 21. Delete • There are different scenarios for deletion: • Deletion at the Beginning of Singly Linked List: • Deletion at the End of Singly Linked List: • Deletion at a Specific Position of Singly Linked List:
  • 26. Algorithm is to delete a node containing a specified key Purpose: The purpose of this algorithm is to delete a node containing a specified key value from a singly linked list. The algorithm traverses the list to locate the node with the target value and removes it while maintaining the integrity of the linked list. Problem Statement: Given a singly linked list and a key value, delete the node that contains the specified key. Update the list and ensure all pointers are correctly adjusted.
  • 27. Input: A pointer to the head of the linked list. An integer key that represents the value of the node to be deleted. Output: The modified linked list after deleting the node with the given key. If the key is not found, the list remains unchanged. Constraints: The list may be empty. The key may be located anywhere in the list. The node to be deleted may be the first, middle, or last node. Algorithm is to delete a node containing a specified key
  • 28. Algorithm: Step 1: Start Define a function deleteNode(head, key) that takes the head of the list and the key as arguments. Step 2: Check if List is Empty If head == null, print "List is empty" and return head. Step 3: Check if Head Node Holds the Key Check if the head node contains the key: If head.data == key, update the head pointer to the next node using: head = head.next Return the updated list. Algorithm is to delete a node containing a specified key
  • 29. Step 4: Initialize Pointers Create two pointers: prev → Points to null initially. current → Points to head. Step 5: Traverse the List to Find the Key Loop through the list until current != null: If current.data == key: Update the next pointer of the previous node: prev.next = current.next Break the loop and delete the node. Else: Move prev to current. Move current to current.next. Algorithm is to delete a node containing a specified key
  • 30. Algorithm is to delete a node containing a specified key Step 6: Check if Key was Found If the key was not found (current == null), print "Key not found" and return head. Step 7: Return Updated List Return the modified list with the node deleted.
  • 31. Algorithm is to delete a node containing a specified key Pseudocode: Function deleteNode(head, key): If head == NULL: Print "List is empty" Return head If head.data == key: head = head.next Return head prev ← NULL current ← head While current != NULL: If current.data == key: prev.next = current.next Break prev ← current current ← current.next If current == NULL: Print "Key not found" Return head
  • 32. Insert • Insertion is a fundamental operation in linked lists that involves adding a new node to the list. There are several scenarios for insertion: • Insertion at the Beginning of Singly Linked List: • Insertion at the End of Singly Linked List: • Insertion at a Specific Position of the Singly Linked List:
  • 36. Algorithm to Insert node • The purpose of this algorithm is to insert a node with a given key value at a specified position in a singly linked list. The node can be inserted: • At the beginning. • At a specific position. • At the end if the position exceeds the length of the list.
  • 37. Input: •A pointer to the head of the linked list. •An integer key representing the value to be inserted. •An integer position representing the 0-based index where the node should be inserted. Algorithm to Insert node in a Linked List Output: •The modified linked list after inserting the new node at the specified position. •If the position is invalid, the list remains unchanged, and an appropriate message is printed.
  • 38. Algorithm to Insert node in a Linked List Constraints: The list may be empty. If position == 0, the node is inserted at the beginning. If position > length of list, the node is inserted at the end. Position cannot be negative.
  • 39. Algorithm to Insert node in a Linked List Step 1: Start Define a function insertAtPosition(head, key, position) that takes the head of the list, the key, and the position as arguments. Step 2: Check for Invalid Position If position < 0, print: "Invalid position" Return head. Step 3: Create a New Node Allocate memory for a new node. Set: newNode.data = key newNode.next = NULL
  • 40. Algorithm to Insert node in a Linked List Step 5: Traverse the List to Find the Position Create a pointer temp and initialize it to head. Initialize a counter count = 0. Traverse the list while temp != NULL and count < position - 1: Move temp to temp.next. Increment count. Step 6: Check if Position is Out of Bounds If temp == NULL and position > count + 1 print: "Position out of bounds, inserting at the end" Traverse to the last node and insert the new node at the end.
  • 41. Algorithm to Insert node in a Linked List Step 7: Insert Node at Desired Position If temp != NULL: Update pointers to insert newNode: newNode.next = temp.next temp.next = newNode Step 8: Return Updated List Return the modified list after inserting the node.
  • 42. Pseudocode: Function insertAtPosition(head, key, position): If position < 0: Print "Invalid position" Return head Create newNode newNode.data = key newNode.next = NULL If position == 0: newNode.next = head head = newNode Return head temp ← head count ← 0 While temp != NULL AND count < position - 1: temp ← temp.next count ← count + 1 If temp == NULL: Print “Inserting at the end" temp ← head While temp.next != NULL: temp ← temp.next temp.next = newNode Return head newNode.next = temp.next temp.next = newNode Return head
  • 43. 2. Circular Single LinkedList • A single linkedlist can be made as circular single linkedlist in which pointer field of last node will contain the address of first node.
  • 44. Example of Circular Single LinkedList 100 START info next 100 info next 200 info next 300 10 200 20 300 30 100
  • 45. Advantage of Circular Single LinkedList • In it, from last node we can move directly to the first node of circular single LinkedList because pointer field of last node will contain the address of first node.
  • 46. Disadvantage of Circular Single Linked List • In it, we can not access previous node from the current node. • This problem can be removed in doubly LinkedList.
  • 47. 3. Doubly LinkedList • It is also called Two-way linked list. • Here each node will contain 3 fields. First field will contain the address of previous node. It is also called previous pointer. • Second field will contain the information of element is called data field.
  • 48. Cont… • Third field will contain the address of next node is called next pointer.
  • 49. Example of Doubly LinkedList 100 prev info next NULL 200 10 200 prev info next 100 300 20 100 300 prev info next 200 NULL 30 START
  • 50. Advantage of Doubly LinkedList • In it, we can we can move previous and next node from the current node because every node contain the address of previous and next node.
  • 51. Disadvantage of Doubly LinkedList • Doubly LinkedList require more memory than single linkedlist because every node of it contain 3 field. Two pointer and one data field.
  • 52. 4. Circular Doubly LinkedList • A doubly linkedlist can be made as circular doubly linkedlist in which the previous pointer of first node will contain the address of last node and next pointer of last node will contain the address of first node.
  • 53. Example of Circular Doubly LinkedList 100 prev info next 300 200 10 200 prev info next 100 300 20 100 300 prev info next 200 100 30 START
  • 54. Advantage of Circular Doubly LinkedList • In it, from first node we can move directly to the last node because previous pointer of first node will contain the address of last node. • In it, from last node we can move directly to the first node because next pointer of last node will contain the address of first node.
  • 55. Advantage of LinkedList • LinkedList is a dynamic data structure i.e they can increase or decrease a node during the execution of a program. • The size is not fixed. • Data can store non-continuous memory block.
  • 56. Cont… • Insertion and deletion of a node are easier and efficient.
  • 57. Disadvantage of LinkedList • More Memory Required: In the linked list there is an special field called pointer field which hold the address of next node so linked list requires extra space. • Accessing to random data item is time consuming.
  • 58. Syntax to create a node of LinkedList struct structure name { datatype variablename; struct structure name *pointervariablename; }; Example: struct node { int info; struct node *next; };
  • 60. References • Text • https://www.geeksforgeeks.org/singly-linked-list-tutorial/ • https://www.geeksforgeeks.org/linked-list-data-structure/?ref=lbp •