SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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é
 

Semelhante a 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
 

Semelhante a 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
 

Último

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Último (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Linked lists by ammara siddiqui