SlideShare a Scribd company logo
Linked lists
What are linked lists?
• Structure to store data similar to a train.
DATA REF DATA REF DATA REF DATA REF
Value Address
Why linked list?
• When the number of elements stored may
change.
Program reports students’ final scores from a Fall Java class:
Array of 50 students
75 83 46 75 95 15 65……………………………….
What if the number of students changes to 60 two weeks into
the Fall quarter? We need a dynamic data structure.
75 REF 83 REF 46 REF 75 REF
ADD
ME!!
Why linked list?
• Insertions and deletions achieved without
moving all the elements.
In an array:
75 83 46 75 95 15 65
12
…………………………………..
In a list:
75 REF 83 REF 46 REF 75 NULL
12 REF
List in Java – the Node structure
DATA REF
Value Address
public class Node {
//Data
public String studentName;
public int score;
//Reference to next node
public Node next;
}
Nodes and references
Name Score
Stacy
Edmund
75
Huan Liu 46
Neil Walters 83
Erwin
Espinoza
75
Neil
Walters
83
Node@1034bb5
Huan Liu
46
Node@7f5f5897
1034bb5
List structure
First In Last Out
Erwin REF Neil REF Huan REF Stacy NULL
Name Score
Stacy
Edmund
75
Huan Liu 46
Neil Walters 83
Erwin
Espinoza
75
H
H = Header Node
HH
Adding to a list
• Add Cindy Chang at position 3
Erwin REF Neil REF Huan REF Stacy NULL
Cindy REF
Deleting from a list
• Remove Neil Waters
Erwin REF Neil REF Huan REF Stacy NULL
Cindy REF
Linked lists

More Related Content

RTF
TRABAJO SOCIALES
PPTX
4.2.8 mapa y plano
DOCX
Updated CV Jan. 2017
PDF
Mb0038 summer 2014
PPTX
Construimos un arbol clase 4 primer grado
PPTX
Experiencias 1 a 1 en argentina, chile y uruguay
PDF
Son of-fatherland.1821.73
PDF
Abdomen agudo 0
TRABAJO SOCIALES
4.2.8 mapa y plano
Updated CV Jan. 2017
Mb0038 summer 2014
Construimos un arbol clase 4 primer grado
Experiencias 1 a 1 en argentina, chile y uruguay
Son of-fatherland.1821.73
Abdomen agudo 0

Viewers also liked (14)

PDF
PDF
Rankings_2007.09
PDF
2.9teen AGAIN BABYDOLL NIGHTWEAR
DOCX
Cody Adams Resume 10.4.16
PPTX
Le tremplin 2016
PPS
Triangulodelavidayterremotos 100320085459-phpapp01
PDF
CapabilitiesBrochure_TL_novarnish_2014
PDF
Thailand (Bangkok, Phuket, Pattaya) packages
DOCX
Methode Ground Anchor
PPTX
Туле
PDF
Curso de inseminacion artificial. Dr. Otoniel López
PDF
Стратегия развития острова Руссий (SPG)
PPTX
AHSArt: Composition for Still-Life Colored Pencil Reference Photos
PPTX
Vifi product training
Rankings_2007.09
2.9teen AGAIN BABYDOLL NIGHTWEAR
Cody Adams Resume 10.4.16
Le tremplin 2016
Triangulodelavidayterremotos 100320085459-phpapp01
CapabilitiesBrochure_TL_novarnish_2014
Thailand (Bangkok, Phuket, Pattaya) packages
Methode Ground Anchor
Туле
Curso de inseminacion artificial. Dr. Otoniel López
Стратегия развития острова Руссий (SPG)
AHSArt: Composition for Still-Life Colored Pencil Reference Photos
Vifi product training
Ad

Similar to Linked lists (20)

PPTX
Chapter 4 Linked List introduction lessons.pptx
PPTX
What is Link list? explained with animations
PDF
singly linked_list
PDF
Unit 1_SLL and DLL.pdf
PDF
Unit 1_Single Linked List and Double Linked List.pdf
PPTX
Linked list
PPT
PPT
PPT
PPTX
Data structure day1
PPT
1 list datastructures
PPT
LINKED LIST IN C++ +2 COMPUTER SCIENCE CBSE AND STATE SYLLABUS
DOCX
Linked list.docx
PDF
linklked lisdi.pdf
PPTX
Linked Lists
PPTX
Linked List.pptx
PPTX
Linked List.pptx
PPTX
Linked lists
PDF
Linked list
PPTX
Linked list, Singly link list and its operations
Chapter 4 Linked List introduction lessons.pptx
What is Link list? explained with animations
singly linked_list
Unit 1_SLL and DLL.pdf
Unit 1_Single Linked List and Double Linked List.pdf
Linked list
Data structure day1
1 list datastructures
LINKED LIST IN C++ +2 COMPUTER SCIENCE CBSE AND STATE SYLLABUS
Linked list.docx
linklked lisdi.pdf
Linked Lists
Linked List.pptx
Linked List.pptx
Linked lists
Linked list
Linked list, Singly link list and its operations
Ad

Recently uploaded (20)

PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
DOCX
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PPTX
assetexplorer- product-overview - presentation
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PPTX
history of c programming in notes for students .pptx
PDF
Nekopoi APK 2025 free lastest update
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
17 Powerful Integrations Your Next-Gen MLM Software Needs
Greta — No-Code AI for Building Full-Stack Web & Mobile Apps
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
assetexplorer- product-overview - presentation
Why Generative AI is the Future of Content, Code & Creativity?
history of c programming in notes for students .pptx
Nekopoi APK 2025 free lastest update
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Advanced SystemCare Ultimate Crack + Portable (2025)
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Designing Intelligence for the Shop Floor.pdf
AutoCAD Professional Crack 2025 With License Key
Design an Analysis of Algorithms I-SECS-1021-03
Design an Analysis of Algorithms II-SECS-1021-03
Digital Systems & Binary Numbers (comprehensive )
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Complete Guide to Website Development in Malaysia for SMEs
Embracing Complexity in Serverless! GOTO Serverless Bengaluru

Linked lists

  • 2. What are linked lists? • Structure to store data similar to a train. DATA REF DATA REF DATA REF DATA REF Value Address
  • 3. Why linked list? • When the number of elements stored may change. Program reports students’ final scores from a Fall Java class: Array of 50 students 75 83 46 75 95 15 65………………………………. What if the number of students changes to 60 two weeks into the Fall quarter? We need a dynamic data structure. 75 REF 83 REF 46 REF 75 REF ADD ME!!
  • 4. Why linked list? • Insertions and deletions achieved without moving all the elements. In an array: 75 83 46 75 95 15 65 12 ………………………………….. In a list: 75 REF 83 REF 46 REF 75 NULL 12 REF
  • 5. List in Java – the Node structure DATA REF Value Address public class Node { //Data public String studentName; public int score; //Reference to next node public Node next; }
  • 6. Nodes and references Name Score Stacy Edmund 75 Huan Liu 46 Neil Walters 83 Erwin Espinoza 75 Neil Walters 83 Node@1034bb5 Huan Liu 46 Node@7f5f5897 1034bb5
  • 7. List structure First In Last Out Erwin REF Neil REF Huan REF Stacy NULL Name Score Stacy Edmund 75 Huan Liu 46 Neil Walters 83 Erwin Espinoza 75 H H = Header Node HH
  • 8. Adding to a list • Add Cindy Chang at position 3 Erwin REF Neil REF Huan REF Stacy NULL Cindy REF
  • 9. Deleting from a list • Remove Neil Waters Erwin REF Neil REF Huan REF Stacy NULL Cindy REF