SlideShare a Scribd company logo
Welcome To our Presentation
Everyone
Topic -Linked List
Topics We are gonna cover
1.What Is Linked List & It's Application
2.Linked List Vs Arrays
3.Creation Of Linked list
4.Insertion Of Linked List
5.Deletion At Link List
6.Searching In Linked List
7.Find Middle Element Of Linked List
What Is Linked List
A linked list is a linear data structure, in which the elements are
not stored at contiguous memory locations. The elements in a
linked list are linked using pointers as shown in the below image:
Types Of Linked List
There are mainly three types of linked lists:
• Single-linked list
• Double linked list
• Circular linked list
Linked List Applications
Applications of linked list in computer science:
1.Implementation of stacks and queues
2.Implementation of graphs: Adjacency list representation of graphs is the
most popular which uses a linked list to store adjacent vertices.
3.Dynamic memory allocation: We use a linked list of free blocks.
4.Maintaining a directory of names
5.Performing arithmetic operations on long integers
Applications of linked list in the real world:
1.Image viewer
2.Previous and next page in a web browser
3.Music Player
4.File Systems
5.Undo/Redo Functionality
Linked List Vs Arrays
Linked List Vs Arrays
Creation Of
Linked list
Steps
1.Define the Node Structure
2.Create the Head Node
3.Append a New Node
4.Traverse the Linked List
struct Node {
int data;
struct Node *next;
};
//for creating a new node
struct Node *createNode(int value){
struct Node *newnode =(struct Node*) malloc(sizeof(struct Node));
if(newnode==NULL){
printf("Memory allocation failedn");
exit(1);
}
newnode->data = value;
newnode->next = NULL;
return newnode;
}
Insertion Of lInked List
Insetion At Head
To insert a node at the start/beginning/front of a Linked List, we need to:
• Make the first node of Linked List linked to the new node
• Remove the head from the original first node of Linked List
• Make the new node as the Head of the Linked List.
Insertion At Tail
To insert a node at the end of a Linked List, we need to:
• Go to the last node of the Linked List
• Change the next pointer of last node from NULL to the new node
• Make the next pointer of new node as NULL to show the end of Linked
List
To insert a node after a given node in a Linked List, we need to:
• Check if the given node exists or not.
⚬ If it do not exists,
■ terminate the process.
⚬ If the given node exists,
■ Make the element to be inserted as a new node
■ Change the next pointer of given node to the new node
■ Now shift the original next pointer of given node to the next pointer of new node
Insert After a Node
Deletion Of Node At begining
Point head to the next node i.e. second node
temp = head
head = head->next
Make sure to free unused memory
free(temp); or delete temp;
Search an element in a Linked List
• Finding anelement
• Initialize a node pointer, current = head.
• Do following while current is not NULL
⚬ If the current value (i.e., current->key) is equal to the key being
searched return true.
⚬ Otherwise, move to the next node (current = current->next).
• If the key is not found, return false
Middle Element of
Linked List
Traverse linked list using two-pointers. Move one pointer by one and the
other pointers by two. When the fast pointer reaches the end, the slow
pointer will reach the middle of the linked list.
Below image shows how printMiddle function works in the code :
Thank You Everyone

More Related Content

Similar to LinkedList Presentation.pptx

ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
KamranAli649587
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
Abdullah Al-hazmy
 
Lecture3
Lecture3Lecture3
Lecture3
Muhammad Zubair
 
Lecture3
Lecture3Lecture3
Lecture3
Muhammad Zubair
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
sandeep54552
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
rajveersingh643731
 
Linked lists
Linked listsLinked lists
Linked lists
Eleonora Ciceri
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
shameen khan
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
ssuserd2f031
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
NathanielAdika
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
ssuser7922b8
 
Linked List
Linked ListLinked List
Linked List
Ashim Lamichhane
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.
JAYANTAOJHA
 
Linked list
Linked listLinked list
Linked list
Muhammad Qasim
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
DarbhalaPavanKumar
 
Linked Lists in Python, Python Institute in Delhi.pdf
Linked Lists in Python, Python Institute in Delhi.pdfLinked Lists in Python, Python Institute in Delhi.pdf
Linked Lists in Python, Python Institute in Delhi.pdf
ESS Institute
 
Linked List Presentation in data structurepptx
Linked List Presentation in data structurepptxLinked List Presentation in data structurepptx
Linked List Presentation in data structurepptx
nikhilcse1
 
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
 
linked list
linked list linked list
linked list
Mohaimin Rahat
 
ds bridge.pptx
ds bridge.pptxds bridge.pptx
ds bridge.pptx
GOOGLEINTERNETCAFE1
 

Similar to LinkedList Presentation.pptx (20)

ds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdfds-lecture-4-171012041008 (1).pdf
ds-lecture-4-171012041008 (1).pdf
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
Lecture3
Lecture3Lecture3
Lecture3
 
Lecture3
Lecture3Lecture3
Lecture3
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
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
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
lecture 02.2.ppt
lecture 02.2.pptlecture 02.2.ppt
lecture 02.2.ppt
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Linked List
Linked ListLinked List
Linked List
 
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.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
Linked Lists in Python, Python Institute in Delhi.pdf
Linked Lists in Python, Python Institute in Delhi.pdfLinked Lists in Python, Python Institute in Delhi.pdf
Linked Lists in Python, Python Institute in Delhi.pdf
 
Linked List Presentation in data structurepptx
Linked List Presentation in data structurepptxLinked List Presentation in data structurepptx
Linked List Presentation in data structurepptx
 
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 list linked list
linked list
 
ds bridge.pptx
ds bridge.pptxds bridge.pptx
ds bridge.pptx
 

Recently uploaded

Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
iemerc2024
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 

Recently uploaded (20)

Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 

LinkedList Presentation.pptx

  • 1. Welcome To our Presentation Everyone Topic -Linked List
  • 2. Topics We are gonna cover 1.What Is Linked List & It's Application 2.Linked List Vs Arrays 3.Creation Of Linked list 4.Insertion Of Linked List 5.Deletion At Link List 6.Searching In Linked List 7.Find Middle Element Of Linked List
  • 3. What Is Linked List A linked list is a linear data structure, in which the elements are not stored at contiguous memory locations. The elements in a linked list are linked using pointers as shown in the below image:
  • 4. Types Of Linked List There are mainly three types of linked lists: • Single-linked list • Double linked list • Circular linked list
  • 5. Linked List Applications Applications of linked list in computer science: 1.Implementation of stacks and queues 2.Implementation of graphs: Adjacency list representation of graphs is the most popular which uses a linked list to store adjacent vertices. 3.Dynamic memory allocation: We use a linked list of free blocks. 4.Maintaining a directory of names 5.Performing arithmetic operations on long integers Applications of linked list in the real world: 1.Image viewer 2.Previous and next page in a web browser 3.Music Player 4.File Systems 5.Undo/Redo Functionality
  • 6. Linked List Vs Arrays
  • 7. Linked List Vs Arrays
  • 9. Steps 1.Define the Node Structure 2.Create the Head Node 3.Append a New Node 4.Traverse the Linked List
  • 10. struct Node { int data; struct Node *next; }; //for creating a new node struct Node *createNode(int value){ struct Node *newnode =(struct Node*) malloc(sizeof(struct Node)); if(newnode==NULL){ printf("Memory allocation failedn"); exit(1); } newnode->data = value; newnode->next = NULL; return newnode; }
  • 12. Insetion At Head To insert a node at the start/beginning/front of a Linked List, we need to: • Make the first node of Linked List linked to the new node • Remove the head from the original first node of Linked List • Make the new node as the Head of the Linked List.
  • 13. Insertion At Tail To insert a node at the end of a Linked List, we need to: • Go to the last node of the Linked List • Change the next pointer of last node from NULL to the new node • Make the next pointer of new node as NULL to show the end of Linked List
  • 14. To insert a node after a given node in a Linked List, we need to: • Check if the given node exists or not. ⚬ If it do not exists, ■ terminate the process. ⚬ If the given node exists, ■ Make the element to be inserted as a new node ■ Change the next pointer of given node to the new node ■ Now shift the original next pointer of given node to the next pointer of new node Insert After a Node
  • 15. Deletion Of Node At begining Point head to the next node i.e. second node temp = head head = head->next Make sure to free unused memory free(temp); or delete temp;
  • 16. Search an element in a Linked List
  • 17. • Finding anelement • Initialize a node pointer, current = head. • Do following while current is not NULL ⚬ If the current value (i.e., current->key) is equal to the key being searched return true. ⚬ Otherwise, move to the next node (current = current->next). • If the key is not found, return false
  • 19. Traverse linked list using two-pointers. Move one pointer by one and the other pointers by two. When the fast pointer reaches the end, the slow pointer will reach the middle of the linked list. Below image shows how printMiddle function works in the code :