SlideShare a Scribd company logo
1 of 43
Linked Lists
Outline
 Introduction
 Insertion

Description
 Deletion Description
 Basic Node Implementation
 Conclusion
Outline
 Introduction
 Insertion

Description
 Deletion Description
 Basic Node Implementation
 Conclusion
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Defination:
A linked list is a series of connected nodes (or links)
where each node is a data structure.
Dynamically allocated data structures can be linked
together to form a chain.
A linked list can grow or shrink in size as the program
runs.This is possible because the nodes in a linked list are
dynamically allocated.
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Lists and arrays
 Lists:
Lists and arrays
 Arrays:
{Size of the following array is = 4}

Index
Value

0
44

1
5

2
96

3
3
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Nodes and pointers
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Single linked lists
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Double Linked Lists
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Circular Lists
Introduction
 Definitions






Lists and arrays
Nodes and pointers
Single Linked Lists
Double Linked Lists
Circular Lists

 Advantages
Advantages
 Linked

lists are more complex to code and manage
than arrays, but they have some distinct advantages.

a) A
◦

linked list can easily grow and shrink in size The programmer doesn’t need to know
how many nodes will be in the list. They are
created in memory as needed.
b) Speed of insertion or deletion from the list ◦
Inserting and deleting elements into and
out of arrays requires moving elements of the array.
When a node is inserted, or deleted from a linked
list, none of the other nodes have to be moved
.
Outline
 Introduction
 Insertion

Description
 Deletion Description
 Basic Node Implementation
 Conclusion
Insertion Description
 Insertion

at the top of the list
 Insertion at the end of the list
 Insertion in the middle of the list
Insertion Description
 Insertion

at the top of the list
 Insertion at the end of the list
 Insertion in the middle of the list
Insertion at the top
Steps:
 Create a Node
 Set the node data Values
 Connect the pointers
Insertion Description
head
 Follow

48

17

142

the previous steps and we get

Step 1

Step 2

Step 3

head

93

//
Insertion Description
 Insertion

at the top of the list
 Insertion at the end of the list
 Insertion in the middle of the list
Insertion at the end
Steps:
 Create a Node
 Set the node data Values
 Connect the pointers
Insertion Description
head
 Follow
Step 1

48

17

142

the previous steps and we get
Step 2

Step 3

//
Insertion Description
 Insertion

at the top of the list
 Insertion at the end of the list
 Insertion in the middle of the list
Insertion in the middle
Steps:
 Create a Node
 Set the node data Values
 Break pointer connection
 Re-connect the pointers
Insertion Description
Step 1

Step 3

Step 4

Step 2
Outline
 Introduction
 Insertion

Description
 Deletion Description
 Basic Node Implementation
 Conclusion
Deletion Description
 Deleting

from the top of the list
 Deleting from the end of the list
 Deleting from the middle of the list
Deletion Description
 Deleting

from the top of the list
 Deleting from the end of the list
 Deleting from the middle of the list
Deleting from the top
Steps
 Break the pointer connection
 Re-connect the nodes
 Delete the node
Deletion Description
head
6

4

17

42

6

4

17

42

4

17

42

head

head
Deletion Description
 Deleting

from the top of the list
 Deleting from the end of the list
 Deleting from the middle of the list
Deleting from the end
Steps
 Break the pointer connection
 Set previous node pointer to NULL
 Delete the node
Deletion Description
head
6

head

4

17

6

4

17

6

4

17

head

42

42
Deletion Description
 Deleting

from the top of the list
 Deleting from the end of the list
 Deleting from the middle of the list
Deleting from the Middle
Steps
 Set previous Node pointer to next node
 Break Node pointer connection
 Delete the node
Deletion Description
head
4

17

42

head
4

17

head
4

42

42
Outline
 Introduction
 Insertion

Description
 Deletion Description
 Basic Node Implementation
 Conclusion
Basic Node Implementation
The following code is written in C++:
Struct Node
{
int data;

be another struct

Node *next;

piece of code “pointer”

};

//any type of data could
//this is an important
Outline
 Introduction
 Insertion

Description
 Deletion Description
 Basic Node Implementation
 Conclusion

More Related Content

What's hot

Lesson8 creating complex formulas
Lesson8 creating complex formulasLesson8 creating complex formulas
Lesson8 creating complex formulas
ricsanmae
 
Math project final 1
Math project final 1Math project final 1
Math project final 1
Rain Wolf's
 

What's hot (17)

Sql joins
Sql joinsSql joins
Sql joins
 
Normalization.riz
Normalization.rizNormalization.riz
Normalization.riz
 
OrACLE RELATIONAL
OrACLE RELATIONALOrACLE RELATIONAL
OrACLE RELATIONAL
 
Lesson8 creating complex formulas
Lesson8 creating complex formulasLesson8 creating complex formulas
Lesson8 creating complex formulas
 
Bt0075 rdbms with mysql 2
Bt0075 rdbms with mysql 2Bt0075 rdbms with mysql 2
Bt0075 rdbms with mysql 2
 
Linked List data structure
Linked List data structureLinked List data structure
Linked List data structure
 
Relational data model
Relational data modelRelational data model
Relational data model
 
Lecture8 Normalization Aggarwal
Lecture8 Normalization AggarwalLecture8 Normalization Aggarwal
Lecture8 Normalization Aggarwal
 
Join sql
Join sqlJoin sql
Join sql
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
OUTPUT Clause Correlated Subqueries and Subquery Extensions
OUTPUT Clause Correlated Subqueries and Subquery ExtensionsOUTPUT Clause Correlated Subqueries and Subquery Extensions
OUTPUT Clause Correlated Subqueries and Subquery Extensions
 
Sql join
Sql  joinSql  join
Sql join
 
Math project final 1
Math project final 1Math project final 1
Math project final 1
 
functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with example
 
PHP mysql Mysql joins
PHP mysql  Mysql joinsPHP mysql  Mysql joins
PHP mysql Mysql joins
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 

Viewers also liked

Mouvement des droits civiques
Mouvement des droits civiquesMouvement des droits civiques
Mouvement des droits civiques
ethanstultz
 
About bininj manbolh project slide presentation
About bininj manbolh project slide presentationAbout bininj manbolh project slide presentation
About bininj manbolh project slide presentation
Ben Tyler
 
Ets strenne 2015 presentazione
Ets strenne 2015 presentazioneEts strenne 2015 presentazione
Ets strenne 2015 presentazione
Alberto Porro
 
Teens and social media at ths
Teens and social media at ths Teens and social media at ths
Teens and social media at ths
dreamcatchersali
 
Engineering Inc_Full Issue_SeptemberOctober 2013
Engineering Inc_Full Issue_SeptemberOctober 2013Engineering Inc_Full Issue_SeptemberOctober 2013
Engineering Inc_Full Issue_SeptemberOctober 2013
Jeff Holcomb
 
Presentation1
Presentation1Presentation1
Presentation1
Yogi Lavi
 
De santurce à bilbao (andrés) envoyé
De santurce à bilbao (andrés) envoyéDe santurce à bilbao (andrés) envoyé
De santurce à bilbao (andrés) envoyé
andres8008
 

Viewers also liked (16)

Stress management
Stress managementStress management
Stress management
 
CST PISCINAS
CST PISCINASCST PISCINAS
CST PISCINAS
 
Mouvement des droits civiques
Mouvement des droits civiquesMouvement des droits civiques
Mouvement des droits civiques
 
About bininj manbolh project slide presentation
About bininj manbolh project slide presentationAbout bininj manbolh project slide presentation
About bininj manbolh project slide presentation
 
Лекция о языке программирования Haskell
Лекция о языке программирования HaskellЛекция о языке программирования Haskell
Лекция о языке программирования Haskell
 
Are you Sick and Tired of being sick and tired?
Are you Sick and Tired of being sick and tired?Are you Sick and Tired of being sick and tired?
Are you Sick and Tired of being sick and tired?
 
Question 3. What have you learned from your audience feedback?
Question 3. What have you learned from your audience feedback?Question 3. What have you learned from your audience feedback?
Question 3. What have you learned from your audience feedback?
 
Ets strenne 2015 presentazione
Ets strenne 2015 presentazioneEts strenne 2015 presentazione
Ets strenne 2015 presentazione
 
Social help in india
Social help in indiaSocial help in india
Social help in india
 
Teens and social media at ths
Teens and social media at ths Teens and social media at ths
Teens and social media at ths
 
Herschberger Permaculture garden/Community Garden Park Forest/Naperville Project
Herschberger Permaculture garden/Community Garden Park Forest/Naperville ProjectHerschberger Permaculture garden/Community Garden Park Forest/Naperville Project
Herschberger Permaculture garden/Community Garden Park Forest/Naperville Project
 
WIS - Web International School
WIS - Web International School WIS - Web International School
WIS - Web International School
 
Engineering Inc_Full Issue_SeptemberOctober 2013
Engineering Inc_Full Issue_SeptemberOctober 2013Engineering Inc_Full Issue_SeptemberOctober 2013
Engineering Inc_Full Issue_SeptemberOctober 2013
 
Promenade des Anglais Apartment For Sale, Nice, France
Promenade des Anglais Apartment For Sale, Nice, France Promenade des Anglais Apartment For Sale, Nice, France
Promenade des Anglais Apartment For Sale, Nice, France
 
Presentation1
Presentation1Presentation1
Presentation1
 
De santurce à bilbao (andrés) envoyé
De santurce à bilbao (andrés) envoyéDe santurce à bilbao (andrés) envoyé
De santurce à bilbao (andrés) envoyé
 

Similar to Linked lists by ammara siddiqui

Final presentation for data structure
Final presentation for data structureFinal presentation for data structure
Final presentation for data structure
shah alom
 
Lec3-Linked list.pptx
Lec3-Linked list.pptxLec3-Linked list.pptx
Lec3-Linked list.pptx
FaheemMahmood2
 

Similar to Linked lists by ammara siddiqui (20)

Linked Lists.pdf
Linked Lists.pdfLinked Lists.pdf
Linked Lists.pdf
 
Final presentation for data structure
Final presentation for data structureFinal presentation for data structure
Final presentation for data structure
 
Link List
Link ListLink List
Link List
 
Double link list
Double link listDouble link list
Double link list
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
 
Data Structures_Linked List
Data Structures_Linked ListData Structures_Linked List
Data Structures_Linked List
 
Lec3-Linked list.pptx
Lec3-Linked list.pptxLec3-Linked list.pptx
Lec3-Linked list.pptx
 
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 and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Linked lists
Linked listsLinked lists
Linked lists
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
linked list
linked list linked list
linked list
 
Linked list.pptx
Linked list.pptxLinked list.pptx
Linked list.pptx
 
Operations on linked list
Operations on linked listOperations on linked list
Operations on linked list
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
csc211_lecture_21.pptx
csc211_lecture_21.pptxcsc211_lecture_21.pptx
csc211_lecture_21.pptx
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 

Recently uploaded

MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
Krashi Coaching
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
Exploring Gemini AI and Integration with MuleSoft | MuleSoft Mysore Meetup #45
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
MSc Ag Genetics & Plant Breeding: Insights from Previous Year JNKVV Entrance ...
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 

Linked lists by ammara siddiqui