SlideShare a Scribd company logo
Linked List
1
Presented by: Rabin BK
Overview of linked list
Inserting a node at a given position
Algorithm
Program
References
2
A sequence of data structures which are connected together via
links
Each link contains a data and data address in connection to another
link
Linked list is the second most used data structure after array
3
Inserting a node at a given position
4
19 100 45 200
100
78 300
200
78 NULL
300
Head= 500
500
5
19 100 45 200
100
78 300
200
78 NULL
300
Head= 500
1 2 3 4
500
struct bag{
data;
struct bag *link;
};
struct bag *node,*temp;
node=size of new structure type node
node->data=x; //Value to be inserted
temp=head;
loop(until int i<position)//traverse
{
temp=temp->link;
}
node->link=temp->link;
temp->link=node;
6
Algorithm
45 200
100
78 300
200
2 3
struct bag{
int data;
struct bag *link;
}
void insert(int x)//value of x is passed from the main function
{
int i;
struct bag *new_node,*temp;
new_node=(struct bag *)malloc(sizeof(struct bag));
node->data=x; //Value to be inserted
temp=*head; //temp=500
for(i=0;i<pos;i++)
{
temp=temp->link;
}
node->link=temp->link;
temp->link=node;
}
7
Program
19 100Head= 500
1
500
x link
address
New node
45 200
100
78 300
200
2 3
8
Finally added node in the 3rd position
19 100 45 400
100
78 600
300
78 NULL
600
Head= 500
1 2 3 4
500
78 300
400
5
References:
Text book:
 Data structure using C/C++, Langsam, Augenstein, Tenenbaum
Web:
http://blog.grkweb.com/2015/04/hackerrank-insert-node-at-
specific.html
https://unacademy.com/lesson/data-structures-insert-a-node-at-the-nth-
position-of-a-linked-list/YHCFSFYX
http://www.knowledge-share.in/c-program-to-insert-a-node-at-front-at-
end-and-at-any-position-in-a-single-linked-list/#.WW9SOOC0nIV
9
Queries
10

More Related Content

PPTX
Singly Linked List
PPTX
Linked list
PPTX
Data structure week y 4
PPTX
Insertion in singly linked list
PDF
Circular linked list
PPTX
Deletion from single way linked list and search
PPTX
Data structure
PPTX
single linked list
Singly Linked List
Linked list
Data structure week y 4
Insertion in singly linked list
Circular linked list
Deletion from single way linked list and search
Data structure
single linked list

What's hot (20)

PPTX
Singly & Circular Linked list
PPT
Linked list
PPTX
Circular link list.ppt
PDF
Singly linked list
PPTX
Stack & Queue using Linked List in Data Structure
PPT
Linked lists
PPT
Linked list
PPTX
Ppt on Linked list,stack,queue
PPTX
Insertion into linked lists
PPTX
Linked list
PPSX
Dynamic memory allocation
PPT
Data Structures with C Linked List
PPSX
Ds06 linked list- insert a node after a given node
PPT
Singly link list
PPTX
Linked List
PPTX
Linked stacks and queues
PPTX
Doubly & Circular Linked Lists
PPTX
Linked Lists
PPT
Link list
Singly & Circular Linked list
Linked list
Circular link list.ppt
Singly linked list
Stack & Queue using Linked List in Data Structure
Linked lists
Linked list
Ppt on Linked list,stack,queue
Insertion into linked lists
Linked list
Dynamic memory allocation
Data Structures with C Linked List
Ds06 linked list- insert a node after a given node
Singly link list
Linked List
Linked stacks and queues
Doubly & Circular Linked Lists
Linked Lists
Link list
Ad

Similar to Linked list in Data structure (20)

PPTX
linked list
PPTX
Unit 5 linked list
PPTX
Unit II Data Structure 2hr topic - List - Operations.pptx
DOCX
Linked list.docx
PDF
DS Module 03.pdf
PPTX
Linked list
PPTX
UNIT 2LINKEDLISdddddddddddddddddddddddddddT.pptx
PPTX
linkedlistforslideshare-210123143943.pptx
PPTX
Linked List Representation of a Linked List.pptx
PPTX
linked list.pptxdj bdjbhjddnbfjdndvdhbfvgh
PPTX
Linked list part-2
PPTX
module 3-.pptx
PDF
Singly Linked List
PDF
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
PPTX
LINKED LIST.pptx
PPT
Linked lists
PPTX
Implemention of Linked list concept in Data Structures
PPTX
DS_LinkedList.pptx
PPT
Lecture3
PPT
Lecture3
linked list
Unit 5 linked list
Unit II Data Structure 2hr topic - List - Operations.pptx
Linked list.docx
DS Module 03.pdf
Linked list
UNIT 2LINKEDLISdddddddddddddddddddddddddddT.pptx
linkedlistforslideshare-210123143943.pptx
Linked List Representation of a Linked List.pptx
linked list.pptxdj bdjbhjddnbfjdndvdhbfvgh
Linked list part-2
module 3-.pptx
Singly Linked List
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
LINKED LIST.pptx
Linked lists
Implemention of Linked list concept in Data Structures
DS_LinkedList.pptx
Lecture3
Lecture3
Ad

More from Rabin BK (20)

PPTX
Artificial Intelligence in E-commerce
PPTX
Three address code generation
PPTX
Consumer Oriented Application, Mercantile process and Mercantile models
PPTX
Clang compiler `
PPTX
Simple Mail Transfer Protocol
PPTX
HTML text formatting tags
PPTX
Data encryption in database management system
PPTX
Object Relational Database Management System(ORDBMS)
PPTX
Kolmogorov Smirnov
PPTX
Job sequencing in Data Strcture
PPTX
Stack Data Structure
PPTX
Bluetooth
PPTX
Data Science
PPTX
Graphics_3D viewing
PPTX
Neural Netwrok
PPTX
Watermarking in digital images
PPTX
Heun's Method
PPTX
Mutual Exclusion
PPTX
Systems Usage
PPTX
Manager of a company
Artificial Intelligence in E-commerce
Three address code generation
Consumer Oriented Application, Mercantile process and Mercantile models
Clang compiler `
Simple Mail Transfer Protocol
HTML text formatting tags
Data encryption in database management system
Object Relational Database Management System(ORDBMS)
Kolmogorov Smirnov
Job sequencing in Data Strcture
Stack Data Structure
Bluetooth
Data Science
Graphics_3D viewing
Neural Netwrok
Watermarking in digital images
Heun's Method
Mutual Exclusion
Systems Usage
Manager of a company

Recently uploaded (20)

PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPT
Project quality management in manufacturing
PPTX
Sustainable Sites - Green Building Construction
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
composite construction of structures.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Welding lecture in detail for understanding
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Lecture Notes Electrical Wiring System Components
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
bas. eng. economics group 4 presentation 1.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Project quality management in manufacturing
Sustainable Sites - Green Building Construction
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
composite construction of structures.pdf
Geodesy 1.pptx...............................................
CH1 Production IntroductoryConcepts.pptx
Welding lecture in detail for understanding
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Lecture Notes Electrical Wiring System Components
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...

Linked list in Data structure

  • 2. Overview of linked list Inserting a node at a given position Algorithm Program References 2
  • 3. A sequence of data structures which are connected together via links Each link contains a data and data address in connection to another link Linked list is the second most used data structure after array 3
  • 4. Inserting a node at a given position 4 19 100 45 200 100 78 300 200 78 NULL 300 Head= 500 500
  • 5. 5 19 100 45 200 100 78 300 200 78 NULL 300 Head= 500 1 2 3 4 500
  • 6. struct bag{ data; struct bag *link; }; struct bag *node,*temp; node=size of new structure type node node->data=x; //Value to be inserted temp=head; loop(until int i<position)//traverse { temp=temp->link; } node->link=temp->link; temp->link=node; 6 Algorithm 45 200 100 78 300 200 2 3
  • 7. struct bag{ int data; struct bag *link; } void insert(int x)//value of x is passed from the main function { int i; struct bag *new_node,*temp; new_node=(struct bag *)malloc(sizeof(struct bag)); node->data=x; //Value to be inserted temp=*head; //temp=500 for(i=0;i<pos;i++) { temp=temp->link; } node->link=temp->link; temp->link=node; } 7 Program 19 100Head= 500 1 500 x link address New node 45 200 100 78 300 200 2 3
  • 8. 8 Finally added node in the 3rd position 19 100 45 400 100 78 600 300 78 NULL 600 Head= 500 1 2 3 4 500 78 300 400 5
  • 9. References: Text book:  Data structure using C/C++, Langsam, Augenstein, Tenenbaum Web: http://blog.grkweb.com/2015/04/hackerrank-insert-node-at- specific.html https://unacademy.com/lesson/data-structures-insert-a-node-at-the-nth- position-of-a-linked-list/YHCFSFYX http://www.knowledge-share.in/c-program-to-insert-a-node-at-front-at- end-and-at-any-position-in-a-single-linked-list/#.WW9SOOC0nIV 9