SlideShare una empresa de Scribd logo
1 de 9
Descargar para leer sin conexión
DATA STRUCTURES AND ALGORITHMS
LAB 6
Bianca Tesila
FILS, March 2014
OBJECTIVES
 Linked Lists
LINKED LISTS: INTRODUCTION
 What is a list?
 What is a linked list?
LISTS: IMPLEMENTATION
 Linked Lists
 Each node contains the information and the link to its
neighbors (doubly linked lists) or to the next element in the
list (singly linked lists )
 The nodes are allocated dynamically
 Dynamic Arrays
 The nodes are stocked in arrays
 If, when adding a new element, the size of the array is
exceeded, the array is reallocated
What are the advantages and disadvantages of each
implementation?
LISTS: BASIC OPERATIONS
o Add – adds an element (entity) to the list: at the
beginning, at the end or at an arbitrary position
o Remove – removes an element (entity) from the
beginning/end of the list or by taking into account its
index/content
o Get – retrieves an element by taking into account its
index
o Update – updates the information/content of an element
!! These operations depend on the chosen implementation.
LINKED LISTS: TYPES
 Singly-linked linear lists
 Doubly-linked linear lists
LINKED LISTS: TYPES
 Singly-linked circular lists
 Doubly-linked circular lists
LINKED LISTS
!!Exercise:
Taking into account the elements of a linked list, store
them in two separate linked lists - one for the even
elements and another one for the odd elements.
HOMEWORK
 Imagine you have a task list. Each task has a
priority and a description. You would like to solve
these tasks according to their priority.
 Whenever you solve a task, you remove it from the
list.
 Implement an application for managing a task list
using a linked list.

Más contenido relacionado

Destacado

Data Structure Lecture 6
Data Structure Lecture 6Data Structure Lecture 6
Data Structure Lecture 6Teksify
 
تعلق باللہ Relationship with Allah
تعلق باللہ  Relationship with Allahتعلق باللہ  Relationship with Allah
تعلق باللہ Relationship with AllahSyeda Javeria
 
Linked lists - Exercises
Linked lists - ExercisesLinked lists - Exercises
Linked lists - ExercisesEleonora Ciceri
 
Van Dievel Transport - bedrijfspresentatie eco
Van Dievel Transport - bedrijfspresentatie ecoVan Dievel Transport - bedrijfspresentatie eco
Van Dievel Transport - bedrijfspresentatie ecoBjorn Claes
 
Nabi s.a.w.w ki daawat e deen
Nabi s.a.w.w ki daawat e deenNabi s.a.w.w ki daawat e deen
Nabi s.a.w.w ki daawat e deenSyeda Javeria
 
Social Media - Introduction, Importance and our Responsibility to spread Islam
Social Media - Introduction, Importance and our Responsibility to spread IslamSocial Media - Introduction, Importance and our Responsibility to spread Islam
Social Media - Introduction, Importance and our Responsibility to spread IslamSyeda Javeria
 
Multimedia Information Retrieval and User Behavior
Multimedia Information Retrieval and User BehaviorMultimedia Information Retrieval and User Behavior
Multimedia Information Retrieval and User BehaviorEleonora Ciceri
 
The CrowdSearch framework
The CrowdSearch frameworkThe CrowdSearch framework
The CrowdSearch frameworkEleonora Ciceri
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked listecomputernotes
 
Dynamic content generation
Dynamic content generationDynamic content generation
Dynamic content generationEleonora Ciceri
 

Destacado (20)

Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Data Structure Lecture 6
Data Structure Lecture 6Data Structure Lecture 6
Data Structure Lecture 6
 
تعلق باللہ Relationship with Allah
تعلق باللہ  Relationship with Allahتعلق باللہ  Relationship with Allah
تعلق باللہ Relationship with Allah
 
Linked lists - Exercises
Linked lists - ExercisesLinked lists - Exercises
Linked lists - Exercises
 
Stack Operation In Data Structure
Stack Operation In Data Structure Stack Operation In Data Structure
Stack Operation In Data Structure
 
Haya aur Iman
Haya aur ImanHaya aur Iman
Haya aur Iman
 
Trees
TreesTrees
Trees
 
Singly linked lists
Singly linked listsSingly linked lists
Singly linked lists
 
Van Dievel Transport - bedrijfspresentatie eco
Van Dievel Transport - bedrijfspresentatie ecoVan Dievel Transport - bedrijfspresentatie eco
Van Dievel Transport - bedrijfspresentatie eco
 
Hazrat ibrahim a.s.
Hazrat ibrahim a.s.Hazrat ibrahim a.s.
Hazrat ibrahim a.s.
 
Nabi s.a.w.w ki daawat e deen
Nabi s.a.w.w ki daawat e deenNabi s.a.w.w ki daawat e deen
Nabi s.a.w.w ki daawat e deen
 
Branding
BrandingBranding
Branding
 
Whatsapp
Whatsapp Whatsapp
Whatsapp
 
Social Media - Introduction, Importance and our Responsibility to spread Islam
Social Media - Introduction, Importance and our Responsibility to spread IslamSocial Media - Introduction, Importance and our Responsibility to spread Islam
Social Media - Introduction, Importance and our Responsibility to spread Islam
 
Multimedia Information Retrieval and User Behavior
Multimedia Information Retrieval and User BehaviorMultimedia Information Retrieval and User Behavior
Multimedia Information Retrieval and User Behavior
 
Linked lists
Linked listsLinked lists
Linked lists
 
The CrowdSearch framework
The CrowdSearch frameworkThe CrowdSearch framework
The CrowdSearch framework
 
HTML5 - An introduction
HTML5 - An introductionHTML5 - An introduction
HTML5 - An introduction
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked list
 
Dynamic content generation
Dynamic content generationDynamic content generation
Dynamic content generation
 

Similar a Data structures and algorithms lab6

linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
List Data Structure
List Data StructureList Data Structure
List Data StructureZidny Nafan
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked listchauhankapil
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm KristinaBorooah
 
Data_structure.pptx
Data_structure.pptxData_structure.pptx
Data_structure.pptxpriya415376
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.JAYANTAOJHA
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxUsriDevi1
 
46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.pptRizwanBasha12
 
Data Structures(Part 1)
Data Structures(Part 1)Data Structures(Part 1)
Data Structures(Part 1)SURBHI SAROHA
 
What is a linked listWhat is a linked lists general syntaxCan .pdf
What is a linked listWhat is a linked lists general syntaxCan .pdfWhat is a linked listWhat is a linked lists general syntaxCan .pdf
What is a linked listWhat is a linked lists general syntaxCan .pdfbhim1213
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Tutort Academy
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptxpijuschal1
 
What are the differences between a linked list and a stack-SolutionA S.docx
What are the differences between a linked list and a stack-SolutionA S.docxWhat are the differences between a linked list and a stack-SolutionA S.docx
What are the differences between a linked list and a stack-SolutionA S.docxloisj1
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxRameshaFernando2
 

Similar a Data structures and algorithms lab6 (20)

linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
List data structure
List data structure List data structure
List data structure
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
Linked Lists
Linked ListsLinked Lists
Linked Lists
 
Data_structure.pptx
Data_structure.pptxData_structure.pptx
Data_structure.pptx
 
Different types of Linked list.
Different types of Linked list.Different types of Linked list.
Different types of Linked list.
 
Linked list
Linked listLinked list
Linked list
 
Linked list ppt
Linked list pptLinked list ppt
Linked list ppt
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
 
46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt46267037-Data-Structures-PPT.ppt
46267037-Data-Structures-PPT.ppt
 
Data Structures(Part 1)
Data Structures(Part 1)Data Structures(Part 1)
Data Structures(Part 1)
 
Unit 3 dsa LINKED LIST
Unit 3 dsa LINKED LISTUnit 3 dsa LINKED LIST
Unit 3 dsa LINKED LIST
 
What is a linked listWhat is a linked lists general syntaxCan .pdf
What is a linked listWhat is a linked lists general syntaxCan .pdfWhat is a linked listWhat is a linked lists general syntaxCan .pdf
What is a linked listWhat is a linked lists general syntaxCan .pdf
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
What are the differences between a linked list and a stack-SolutionA S.docx
What are the differences between a linked list and a stack-SolutionA S.docxWhat are the differences between a linked list and a stack-SolutionA S.docx
What are the differences between a linked list and a stack-SolutionA S.docx
 
Data Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptxData Structures and Algorithms - Lec 05.pptx
Data Structures and Algorithms - Lec 05.pptx
 

Más de Bianca Teşilă

Akka Streams - An Adobe data-intensive story
Akka Streams - An Adobe data-intensive storyAkka Streams - An Adobe data-intensive story
Akka Streams - An Adobe data-intensive storyBianca Teşilă
 
Data structures and algorithms lab11
Data structures and algorithms lab11Data structures and algorithms lab11
Data structures and algorithms lab11Bianca Teşilă
 
Data structures and algorithms lab10
Data structures and algorithms lab10Data structures and algorithms lab10
Data structures and algorithms lab10Bianca Teşilă
 
Data structures and algorithms lab9
Data structures and algorithms lab9Data structures and algorithms lab9
Data structures and algorithms lab9Bianca Teşilă
 
Data structures and algorithms lab8
Data structures and algorithms lab8Data structures and algorithms lab8
Data structures and algorithms lab8Bianca Teşilă
 
Data structures and algorithms lab7
Data structures and algorithms lab7Data structures and algorithms lab7
Data structures and algorithms lab7Bianca Teşilă
 
Data structures and algorithms lab5
Data structures and algorithms lab5Data structures and algorithms lab5
Data structures and algorithms lab5Bianca Teşilă
 
Data structures and algorithms lab4
Data structures and algorithms lab4Data structures and algorithms lab4
Data structures and algorithms lab4Bianca Teşilă
 
Data structures and algorithms lab3
Data structures and algorithms lab3Data structures and algorithms lab3
Data structures and algorithms lab3Bianca Teşilă
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2Bianca Teşilă
 
Data structures and algorithms lab1
Data structures and algorithms lab1Data structures and algorithms lab1
Data structures and algorithms lab1Bianca Teşilă
 

Más de Bianca Teşilă (11)

Akka Streams - An Adobe data-intensive story
Akka Streams - An Adobe data-intensive storyAkka Streams - An Adobe data-intensive story
Akka Streams - An Adobe data-intensive story
 
Data structures and algorithms lab11
Data structures and algorithms lab11Data structures and algorithms lab11
Data structures and algorithms lab11
 
Data structures and algorithms lab10
Data structures and algorithms lab10Data structures and algorithms lab10
Data structures and algorithms lab10
 
Data structures and algorithms lab9
Data structures and algorithms lab9Data structures and algorithms lab9
Data structures and algorithms lab9
 
Data structures and algorithms lab8
Data structures and algorithms lab8Data structures and algorithms lab8
Data structures and algorithms lab8
 
Data structures and algorithms lab7
Data structures and algorithms lab7Data structures and algorithms lab7
Data structures and algorithms lab7
 
Data structures and algorithms lab5
Data structures and algorithms lab5Data structures and algorithms lab5
Data structures and algorithms lab5
 
Data structures and algorithms lab4
Data structures and algorithms lab4Data structures and algorithms lab4
Data structures and algorithms lab4
 
Data structures and algorithms lab3
Data structures and algorithms lab3Data structures and algorithms lab3
Data structures and algorithms lab3
 
Data structures and algorithms lab2
Data structures and algorithms lab2Data structures and algorithms lab2
Data structures and algorithms lab2
 
Data structures and algorithms lab1
Data structures and algorithms lab1Data structures and algorithms lab1
Data structures and algorithms lab1
 

Data structures and algorithms lab6

  • 1. DATA STRUCTURES AND ALGORITHMS LAB 6 Bianca Tesila FILS, March 2014
  • 3. LINKED LISTS: INTRODUCTION  What is a list?  What is a linked list?
  • 4. LISTS: IMPLEMENTATION  Linked Lists  Each node contains the information and the link to its neighbors (doubly linked lists) or to the next element in the list (singly linked lists )  The nodes are allocated dynamically  Dynamic Arrays  The nodes are stocked in arrays  If, when adding a new element, the size of the array is exceeded, the array is reallocated What are the advantages and disadvantages of each implementation?
  • 5. LISTS: BASIC OPERATIONS o Add – adds an element (entity) to the list: at the beginning, at the end or at an arbitrary position o Remove – removes an element (entity) from the beginning/end of the list or by taking into account its index/content o Get – retrieves an element by taking into account its index o Update – updates the information/content of an element !! These operations depend on the chosen implementation.
  • 6. LINKED LISTS: TYPES  Singly-linked linear lists  Doubly-linked linear lists
  • 7. LINKED LISTS: TYPES  Singly-linked circular lists  Doubly-linked circular lists
  • 8. LINKED LISTS !!Exercise: Taking into account the elements of a linked list, store them in two separate linked lists - one for the even elements and another one for the odd elements.
  • 9. HOMEWORK  Imagine you have a task list. Each task has a priority and a description. You would like to solve these tasks according to their priority.  Whenever you solve a task, you remove it from the list.  Implement an application for managing a task list using a linked list.