SlideShare a Scribd company logo
11/28/2020 (c) Dr. Jyoti Lakhani 1
Linked List
Linear Data Structure
Store more than one value in it (Same as array)
11 12 13
start First Node Last Node
pointer
Node Node Node
NULL
11/28/2020 (c) Dr. Jyoti Lakhani 2
Done so far...
Create a Node
Insert Node at Beginning of Linked List
Insert Node at End of Linked List
Insert after or before a given Node
Insert at a given Location
Deletion from Beginning
Deletion from End
Deletion from a given location
Deletion from before or after a given node
Search an item in Linked List
Traverse Linked List
Display Linked List
Count nodes in a Linked List
Algorithm : Insert_after_node(new_node)
Input : A node to be inserted in the Linked List
Output: Linked List with new node at the beginning
Steps:
1. [Case 1: List is empty]
If start == NULL then
print “
2. [Case 2: List if Non- Empty]
ptr = start;
while(ptr->next!=NULL)
{ //Check for info
if(ptr->info==value)
break;
ptr=ptr->next;
}
temp=ptr->next;
ptr->next = new_node;
new_node->next = temp;
11/28/2020 (c) Dr. Jyoti Lakhani 3
Insert a Node in Linked List after given node
11/28/2020 (c) Dr. Jyoti Lakhani 4
11 12 14
start First Node Last Node
NULL
13
new_node
Insert a Node in Linked List after given node
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 5
11 12 14
start First Node Last Node
13
new_node
Insert a Node in Linked List after given node
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 6
11 12 14
start First Node Last Node
13
new_node
Insert a Node in Linked List after given node
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 7
11 12 14
start First Node Last Node
13
new_node
Insert a Node in Linked List after given node
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 8
11 12 14
start First Node Last Node
NULL
13
new_node
Insert a Node in Linked List after given node
ptr
ptr = start
while(ptr->next!=NULL)
if(ptr->info==value)
break;
ptr=ptr->next;
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 9
11 12 14
start First Node Last Node
Insert a Node in Linked List after given node
ptr
NULL
13
new_node
ptr = start
while(ptr->next!=NULL)
if(ptr->info==value)
break;
ptr=ptr->next;
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 10
11 12 14
start First Node Last Node
NULL
13
new_node
Insert a Node in Linked List after given node
ptr
ptr = start
while(ptr->next!=NULL)
if(ptr->info==value)
break;
ptr=ptr->next;
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 11
11 12 13
start First Node Last Node
13
new_node
Insert a Node in Linked List after given node
ptr
temp=ptr->next;
ptr->next = new_node;
new_node->next = temp;
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 12
11 12 13
start First Node Last Node
13
new_node
Insert a Node in Linked List after given node
ptr
temp=ptr->next;
ptr->next = new_node;
new_node->next = temp;
Temp
Key = 12
11/28/2020 (c) Dr. Jyoti Lakhani 13
Assignment
Insert a node before a given node
Ad

More Related Content

What's hot (20)

Doubly linked list (animated)
Doubly linked list (animated)Doubly linked list (animated)
Doubly linked list (animated)
DivyeshKumar Jagatiya
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
Zidny Nafan
 
Linked list
Linked listLinked list
Linked list
Trupti Agrawal
 
single linked list
single linked listsingle linked list
single linked list
Sathasivam Rangasamy
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
maamir farooq
 
Data Structure Lecture 6
Data Structure Lecture 6Data Structure Lecture 6
Data Structure Lecture 6
Teksify
 
linked list
linked list linked list
linked list
Mohaimin Rahat
 
Stack & Queue
Stack & QueueStack & Queue
Stack & Queue
Joyjit Choudhury
 
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structure
Tushar Aneyrao
 
هياكلبيانات
هياكلبياناتهياكلبيانات
هياكلبيانات
Rafal Edward
 
linked list
linked listlinked list
linked list
Shaista Qadir
 
Algorithms: I
Algorithms: IAlgorithms: I
Algorithms: I
Joyjit Choudhury
 
Dynamic memory allocation
Dynamic memory allocationDynamic memory allocation
Dynamic memory allocation
Moniruzzaman _
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
Sumathi Kv
 
Singly link list
Singly link listSingly link list
Singly link list
Rojin Khadka
 
Linked list
Linked listLinked list
Linked list
Priyanka Rana
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
Srajan Shukla
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
Transweb Global Inc
 
Algorithms: II
Algorithms: IIAlgorithms: II
Algorithms: II
Joyjit Choudhury
 
CSE240 Doubly Linked Lists
CSE240 Doubly Linked ListsCSE240 Doubly Linked Lists
CSE240 Doubly Linked Lists
Garrett Gutierrez
 

Similar to Ds06 linked list- insert a node after a given node (20)

Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginning
jyoti_lakhani
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a node
jyoti_lakhani
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
PoonamPatil120
 
Team 10
Team 10Team 10
Team 10
Sathasivam Rangasamy
 
Bsf23006565 dsa 3rd assignment.docx............
Bsf23006565 dsa 3rd assignment.docx............Bsf23006565 dsa 3rd assignment.docx............
Bsf23006565 dsa 3rd assignment.docx............
XEON14
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
Reazul Islam
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
Khuram Shahzad
 
linkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxlinkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptx
MeghaKulkarni27
 
linkedlistwith animations.ppt
linkedlistwith animations.pptlinkedlistwith animations.ppt
linkedlistwith animations.ppt
MuhammadShafi89
 
Linked list
Linked list Linked list
Linked list
Arbind Mandal
 
Linked List
Linked ListLinked List
Linked List
Md gulam sarwar
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
AlliVinay1
 
Data structures linked list introduction.pptx
Data structures linked list introduction.pptxData structures linked list introduction.pptx
Data structures linked list introduction.pptx
Kalpana Mohan
 
DS_LinkedList.pptx
DS_LinkedList.pptxDS_LinkedList.pptx
DS_LinkedList.pptx
msohail37
 
linked-list - Abstract data type (ADT) Linked Lists
linked-list - Abstract data type (ADT) Linked Listslinked-list - Abstract data type (ADT) Linked Lists
linked-list - Abstract data type (ADT) Linked Lists
Anil Yadav
 
Generics and data structures in Java for an introductory programming course
Generics and data structures in Java for an introductory programming courseGenerics and data structures in Java for an introductory programming course
Generics and data structures in Java for an introductory programming course
ZiyanMaraikar1
 
LinkedList1LinkedList1LinkedList1111.pdf
LinkedList1LinkedList1LinkedList1111.pdfLinkedList1LinkedList1LinkedList1111.pdf
LinkedList1LinkedList1LinkedList1111.pdf
timoemin50
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
EricvtJFraserr
 
Data Structures and Agorithm: DS 10 Binary Search Tree.pptx
Data Structures and Agorithm: DS 10 Binary Search Tree.pptxData Structures and Agorithm: DS 10 Binary Search Tree.pptx
Data Structures and Agorithm: DS 10 Binary Search Tree.pptx
RashidFaridChishti
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
JAGDEEPKUMAR23
 
Ds06 linked list- insert a node at beginning
Ds06   linked list- insert a node at beginningDs06   linked list- insert a node at beginning
Ds06 linked list- insert a node at beginning
jyoti_lakhani
 
Ds06 linked list- intro and create a node
Ds06   linked list- intro and create a nodeDs06   linked list- intro and create a node
Ds06 linked list- intro and create a node
jyoti_lakhani
 
Bsf23006565 dsa 3rd assignment.docx............
Bsf23006565 dsa 3rd assignment.docx............Bsf23006565 dsa 3rd assignment.docx............
Bsf23006565 dsa 3rd assignment.docx............
XEON14
 
Data Structures with C Linked List
Data Structures with C Linked ListData Structures with C Linked List
Data Structures with C Linked List
Reazul Islam
 
linkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptxlinkedlist-130914084342-phpapp02.pptx
linkedlist-130914084342-phpapp02.pptx
MeghaKulkarni27
 
linkedlistwith animations.ppt
linkedlistwith animations.pptlinkedlistwith animations.ppt
linkedlistwith animations.ppt
MuhammadShafi89
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
AlliVinay1
 
Data structures linked list introduction.pptx
Data structures linked list introduction.pptxData structures linked list introduction.pptx
Data structures linked list introduction.pptx
Kalpana Mohan
 
DS_LinkedList.pptx
DS_LinkedList.pptxDS_LinkedList.pptx
DS_LinkedList.pptx
msohail37
 
linked-list - Abstract data type (ADT) Linked Lists
linked-list - Abstract data type (ADT) Linked Listslinked-list - Abstract data type (ADT) Linked Lists
linked-list - Abstract data type (ADT) Linked Lists
Anil Yadav
 
Generics and data structures in Java for an introductory programming course
Generics and data structures in Java for an introductory programming courseGenerics and data structures in Java for an introductory programming course
Generics and data structures in Java for an introductory programming course
ZiyanMaraikar1
 
LinkedList1LinkedList1LinkedList1111.pdf
LinkedList1LinkedList1LinkedList1111.pdfLinkedList1LinkedList1LinkedList1111.pdf
LinkedList1LinkedList1LinkedList1111.pdf
timoemin50
 
This assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdfThis assignment and the next (#5) involve design and development of a.pdf
This assignment and the next (#5) involve design and development of a.pdf
EricvtJFraserr
 
Data Structures and Agorithm: DS 10 Binary Search Tree.pptx
Data Structures and Agorithm: DS 10 Binary Search Tree.pptxData Structures and Agorithm: DS 10 Binary Search Tree.pptx
Data Structures and Agorithm: DS 10 Binary Search Tree.pptx
RashidFaridChishti
 
Ad

More from jyoti_lakhani (20)

CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsx
jyoti_lakhani
 
Projections.pptx
Projections.pptxProjections.pptx
Projections.pptx
jyoti_lakhani
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsx
jyoti_lakhani
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsx
jyoti_lakhani
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptx
jyoti_lakhani
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsx
jyoti_lakhani
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
jyoti_lakhani
 
Double ended queue
Double ended queueDouble ended queue
Double ended queue
jyoti_lakhani
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
jyoti_lakhani
 
Priority queue
Priority queuePriority queue
Priority queue
jyoti_lakhani
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from front
jyoti_lakhani
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhani
jyoti_lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhani
jyoti_lakhani
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
jyoti_lakhani
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo code
jyoti_lakhani
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
jyoti_lakhani
 
Ids 016 cooperative intrusion detection
Ids 016 cooperative intrusion detectionIds 016 cooperative intrusion detection
Ids 016 cooperative intrusion detection
jyoti_lakhani
 
Ids 015 architecture and implementation of ids
Ids 015 architecture and implementation of idsIds 015 architecture and implementation of ids
Ids 015 architecture and implementation of ids
jyoti_lakhani
 
Ids 014 anomaly detection
Ids 014 anomaly detectionIds 014 anomaly detection
Ids 014 anomaly detection
jyoti_lakhani
 
Ids 013 detection approaches
Ids 013 detection approachesIds 013 detection approaches
Ids 013 detection approaches
jyoti_lakhani
 
CG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsxCG02 Computer Graphic Systems.ppsx
CG02 Computer Graphic Systems.ppsx
jyoti_lakhani
 
CG04 Color Models.ppsx
CG04 Color Models.ppsxCG04 Color Models.ppsx
CG04 Color Models.ppsx
jyoti_lakhani
 
CG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsxCG03 Random Raster Scan displays and Color CRTs.ppsx
CG03 Random Raster Scan displays and Color CRTs.ppsx
jyoti_lakhani
 
CG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptxCG02 Computer Graphic Systems.pptx
CG02 Computer Graphic Systems.pptx
jyoti_lakhani
 
CG01 introduction.ppsx
CG01 introduction.ppsxCG01 introduction.ppsx
CG01 introduction.ppsx
jyoti_lakhani
 
Tree terminology and introduction to binary tree
Tree terminology and introduction to binary treeTree terminology and introduction to binary tree
Tree terminology and introduction to binary tree
jyoti_lakhani
 
Ds006 linked list- delete from front
Ds006   linked list- delete from frontDs006   linked list- delete from front
Ds006 linked list- delete from front
jyoti_lakhani
 
Ds04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhaniDs04 abstract data types (adt) jyoti lakhani
Ds04 abstract data types (adt) jyoti lakhani
jyoti_lakhani
 
Ds03 part i algorithms by jyoti lakhani
Ds03 part i algorithms   by jyoti lakhaniDs03 part i algorithms   by jyoti lakhani
Ds03 part i algorithms by jyoti lakhani
jyoti_lakhani
 
Ds03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhaniDs03 algorithms jyoti lakhani
Ds03 algorithms jyoti lakhani
jyoti_lakhani
 
Ds02 flow chart and pseudo code
Ds02 flow chart and pseudo codeDs02 flow chart and pseudo code
Ds02 flow chart and pseudo code
jyoti_lakhani
 
Ds01 data structure introduction - by jyoti lakhani
Ds01 data structure  introduction - by jyoti lakhaniDs01 data structure  introduction - by jyoti lakhani
Ds01 data structure introduction - by jyoti lakhani
jyoti_lakhani
 
Ids 016 cooperative intrusion detection
Ids 016 cooperative intrusion detectionIds 016 cooperative intrusion detection
Ids 016 cooperative intrusion detection
jyoti_lakhani
 
Ids 015 architecture and implementation of ids
Ids 015 architecture and implementation of idsIds 015 architecture and implementation of ids
Ids 015 architecture and implementation of ids
jyoti_lakhani
 
Ids 014 anomaly detection
Ids 014 anomaly detectionIds 014 anomaly detection
Ids 014 anomaly detection
jyoti_lakhani
 
Ids 013 detection approaches
Ids 013 detection approachesIds 013 detection approaches
Ids 013 detection approaches
jyoti_lakhani
 
Ad

Recently uploaded (20)

Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
Com fer un pla de gestió de dades amb l'eiNa DMP (en anglès)
CSUC - Consorci de Serveis Universitaris de Catalunya
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à GenèveUiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPath Automation Suite – Cas d'usage d'une NGO internationale basée à Genève
UiPathCommunity
 
IT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information TechnologyIT484 Cyber Forensics_Information Technology
IT484 Cyber Forensics_Information Technology
SHEHABALYAMANI
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Limecraft Webinar - 2025.3 release, featuring Content Delivery, Graphic Conte...
Maarten Verwaest
 
Dark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanizationDark Dynamism: drones, dark factories and deurbanization
Dark Dynamism: drones, dark factories and deurbanization
Jakub Šimek
 
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
Could Virtual Threads cast away the usage of Kotlin Coroutines - DevoxxUK2025
João Esperancinha
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
Top-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptxTop-AI-Based-Tools-for-Game-Developers (1).pptx
Top-AI-Based-Tools-for-Game-Developers (1).pptx
BR Softech
 
Developing System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptxDeveloping System Infrastructure Design Plan.pptx
Developing System Infrastructure Design Plan.pptx
wondimagegndesta
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
Cybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and MitigationCybersecurity Threat Vectors and Mitigation
Cybersecurity Threat Vectors and Mitigation
VICTOR MAESTRE RAMIREZ
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Viam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdfViam product demo_ Deploying and scaling AI with hardware.pdf
Viam product demo_ Deploying and scaling AI with hardware.pdf
camilalamoratta
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)Design pattern talk by Kaya Weers - 2025 (v2)
Design pattern talk by Kaya Weers - 2025 (v2)
Kaya Weers
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 

Ds06 linked list- insert a node after a given node

  • 1. 11/28/2020 (c) Dr. Jyoti Lakhani 1 Linked List Linear Data Structure Store more than one value in it (Same as array) 11 12 13 start First Node Last Node pointer Node Node Node NULL
  • 2. 11/28/2020 (c) Dr. Jyoti Lakhani 2 Done so far... Create a Node Insert Node at Beginning of Linked List Insert Node at End of Linked List Insert after or before a given Node Insert at a given Location Deletion from Beginning Deletion from End Deletion from a given location Deletion from before or after a given node Search an item in Linked List Traverse Linked List Display Linked List Count nodes in a Linked List
  • 3. Algorithm : Insert_after_node(new_node) Input : A node to be inserted in the Linked List Output: Linked List with new node at the beginning Steps: 1. [Case 1: List is empty] If start == NULL then print “ 2. [Case 2: List if Non- Empty] ptr = start; while(ptr->next!=NULL) { //Check for info if(ptr->info==value) break; ptr=ptr->next; } temp=ptr->next; ptr->next = new_node; new_node->next = temp; 11/28/2020 (c) Dr. Jyoti Lakhani 3 Insert a Node in Linked List after given node
  • 4. 11/28/2020 (c) Dr. Jyoti Lakhani 4 11 12 14 start First Node Last Node NULL 13 new_node Insert a Node in Linked List after given node Key = 12
  • 5. 11/28/2020 (c) Dr. Jyoti Lakhani 5 11 12 14 start First Node Last Node 13 new_node Insert a Node in Linked List after given node Key = 12
  • 6. 11/28/2020 (c) Dr. Jyoti Lakhani 6 11 12 14 start First Node Last Node 13 new_node Insert a Node in Linked List after given node Key = 12
  • 7. 11/28/2020 (c) Dr. Jyoti Lakhani 7 11 12 14 start First Node Last Node 13 new_node Insert a Node in Linked List after given node Key = 12
  • 8. 11/28/2020 (c) Dr. Jyoti Lakhani 8 11 12 14 start First Node Last Node NULL 13 new_node Insert a Node in Linked List after given node ptr ptr = start while(ptr->next!=NULL) if(ptr->info==value) break; ptr=ptr->next; Key = 12
  • 9. 11/28/2020 (c) Dr. Jyoti Lakhani 9 11 12 14 start First Node Last Node Insert a Node in Linked List after given node ptr NULL 13 new_node ptr = start while(ptr->next!=NULL) if(ptr->info==value) break; ptr=ptr->next; Key = 12
  • 10. 11/28/2020 (c) Dr. Jyoti Lakhani 10 11 12 14 start First Node Last Node NULL 13 new_node Insert a Node in Linked List after given node ptr ptr = start while(ptr->next!=NULL) if(ptr->info==value) break; ptr=ptr->next; Key = 12
  • 11. 11/28/2020 (c) Dr. Jyoti Lakhani 11 11 12 13 start First Node Last Node 13 new_node Insert a Node in Linked List after given node ptr temp=ptr->next; ptr->next = new_node; new_node->next = temp; Key = 12
  • 12. 11/28/2020 (c) Dr. Jyoti Lakhani 12 11 12 13 start First Node Last Node 13 new_node Insert a Node in Linked List after given node ptr temp=ptr->next; ptr->next = new_node; new_node->next = temp; Temp Key = 12
  • 13. 11/28/2020 (c) Dr. Jyoti Lakhani 13 Assignment Insert a node before a given node
  翻译: