SlideShare una empresa de Scribd logo
1 de 9
Linked Lists
Multiple items?
• Multiple names
  – FredsHouse, JohnsHouse, PetersHouse
  – Problems?
• Arrays
  – House[1], House[2], House[3]
  – Benefits?
  – Problems?
• Indirect Addressing
Drawbacks of Arrays
• Not flexible
• Think about deleting an item from an
  array
• Only allow linear/grid arrangements
• Require you to plan – how big will it
  be? (very hard to make bigger)
Linked lists




This is a big improvement
           Why?
Linked lists




What’s missing?
Linked lists
Exercise
•   Write pseudo-code for the following
    linked list operations:
    1. Insert an item between nodes 3 and 4
    2. Delete node 3
    3. Find out how many items there are in the
       list
    4. Reverse the order of the items.
Linked lists
Linked lists

Más contenido relacionado

Destacado

Destacado (14)

Eternale Beauty Device
Eternale Beauty DeviceEternale Beauty Device
Eternale Beauty Device
 
Lithuania
LithuaniaLithuania
Lithuania
 
VIRGINIDAD
VIRGINIDADVIRGINIDAD
VIRGINIDAD
 
Venganza gatuna
Venganza gatunaVenganza gatuna
Venganza gatuna
 
Cb4
Cb4Cb4
Cb4
 
C6 intelligence Simiplified Due Dilligence whitepaper
C6 intelligence Simiplified Due Dilligence whitepaperC6 intelligence Simiplified Due Dilligence whitepaper
C6 intelligence Simiplified Due Dilligence whitepaper
 
Que Aprendi C)
Que Aprendi C)Que Aprendi C)
Que Aprendi C)
 
Web 2 Hbermeo
Web 2 HbermeoWeb 2 Hbermeo
Web 2 Hbermeo
 
Petani Indonesia Yang Modern Dan Profesional
Petani Indonesia Yang Modern Dan ProfesionalPetani Indonesia Yang Modern Dan Profesional
Petani Indonesia Yang Modern Dan Profesional
 
Frank Orsini D 1 Form
Frank Orsini D 1 FormFrank Orsini D 1 Form
Frank Orsini D 1 Form
 
Technical Certificates
Technical CertificatesTechnical Certificates
Technical Certificates
 
Rk5
Rk5Rk5
Rk5
 
Learning Expeditions
Learning ExpeditionsLearning Expeditions
Learning Expeditions
 
Mixed & Improper
Mixed & ImproperMixed & Improper
Mixed & Improper
 

Más de grahamwell

Excel =if function
Excel =if functionExcel =if function
Excel =if functiongrahamwell
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average grahamwell
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?grahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch developgrahamwell
 
The software story
The software storyThe software story
The software storygrahamwell
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphicsgrahamwell
 
Database field types
Database field typesDatabase field types
Database field typesgrahamwell
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and typesgrahamwell
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and typesgrahamwell
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9grahamwell
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your projectgrahamwell
 
The rail fence
The rail fenceThe rail fence
The rail fencegrahamwell
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryptiongrahamwell
 
Server side scripts
Server side scriptsServer side scripts
Server side scriptsgrahamwell
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and controlgrahamwell
 

Más de grahamwell (20)

Pseudocode
PseudocodePseudocode
Pseudocode
 
Excel =if function
Excel =if functionExcel =if function
Excel =if function
 
Excel Min max-average
Excel Min max-average Excel Min max-average
Excel Min max-average
 
What is binary and why do we use it?
What is binary and why do we use it?What is binary and why do we use it?
What is binary and why do we use it?
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
Introduction to touch develop
Introduction to touch developIntroduction to touch develop
Introduction to touch develop
 
The software story
The software storyThe software story
The software story
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphics
 
Database field types
Database field typesDatabase field types
Database field types
 
Databases 101
Databases 101Databases 101
Databases 101
 
Kodu controls
Kodu controlsKodu controls
Kodu controls
 
Pascal names and types
Pascal names and typesPascal names and types
Pascal names and types
 
Python part two names and types
Python part two names and typesPython part two names and types
Python part two names and types
 
Abstraction - Year 9
Abstraction - Year 9Abstraction - Year 9
Abstraction - Year 9
 
Thinking about your project
Thinking about your projectThinking about your project
Thinking about your project
 
The rail fence
The rail fenceThe rail fence
The rail fence
 
Lesson 1
Lesson 1Lesson 1
Lesson 1
 
Rsa encryption
Rsa encryptionRsa encryption
Rsa encryption
 
Server side scripts
Server side scriptsServer side scripts
Server side scripts
 
Revision topic 1 sensors and control
Revision topic 1 sensors and controlRevision topic 1 sensors and control
Revision topic 1 sensors and control
 

Linked lists

  • 2. Multiple items? • Multiple names – FredsHouse, JohnsHouse, PetersHouse – Problems? • Arrays – House[1], House[2], House[3] – Benefits? – Problems? • Indirect Addressing
  • 3. Drawbacks of Arrays • Not flexible • Think about deleting an item from an array • Only allow linear/grid arrangements • Require you to plan – how big will it be? (very hard to make bigger)
  • 4. Linked lists This is a big improvement Why?
  • 7. Exercise • Write pseudo-code for the following linked list operations: 1. Insert an item between nodes 3 and 4 2. Delete node 3 3. Find out how many items there are in the list 4. Reverse the order of the items.