Doubly Linked Lists or Two-way Linked Lists

Slides:



Advertisements
Similar presentations
Lists CS 3358.
Advertisements

Lists1 © 2010 Goodrich, Tamassia. Position ADT The Position ADT models the notion of place within a data structure where a single object is stored It.
Chapter 17 Linked List Saurav Karmakar Spring 2007.
Review Learn about linked lists
Iterators and Sequences1 © 2010 Goodrich, Tamassia.
© 2004 Goodrich, Tamassia Vectors1. © 2004 Goodrich, Tamassia Vectors2 The Vector ADT (“Vector” = “Array List” in §6.1) The Vector ADT extends the notion.
© 2004 Goodrich, Tamassia Sequences and Iterators1.
Linked Lists. Example We would like to keep a list of inventory records – but only as many as we need An array is a fixed size Instead – use a linked.
© 2004 Goodrich, Tamassia Lists1. © 2004 Goodrich, Tamassia Lists2 Position ADT (§ 5.2.2) The Position ADT models the notion of place within a data structure.
Linked Lists. Example We would like to keep a list of inventory records – but only as many as we need An array is a fixed size Instead – use a linked.
© 2004 Goodrich, Tamassia Vectors1 Lecture 03 Vectors, Lists and Sequences Topics Vectors Lists Sequences.
Doubly Linked Lists1 © 2014 Goodrich, Tamassia, Goldwasser Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition,
© 2004 Goodrich, Tamassia Linked Lists1. © 2004 Goodrich, Tamassia Linked Lists2 Singly Linked List (§ 4.4.1) A singly linked list is a concrete data.
© 2004 Goodrich, Tamassia Sequences and Iterators1.
CSCI 2720 Lists III Eileen Kraemer University of Georgia Spring 2007.
CS 221 Analysis of Algorithms Data Structures Vectors, Lists.
Department of Computer Science Data Structures Using C++ 2E Chapter 5 Linked Lists.
Linked List Chapter Data Abstraction separates the logical properties of a data type from its implementation LOGICAL PROPERTIES – What are the.
© 2014 Goodrich, Tamassia, Goldwasser Singly Linked Lists1 Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition,
© 2004 Goodrich, Tamassia Lists1. © 2004 Goodrich, Tamassia Lists2 Position ADT (§ 5.2.2) The Position ADT models the notion of place within a data structure.
Data Structures Doubly and Circular Lists Lecture 07: Linked Lists
Department of Computer Science 1 Some Practice Let’s practice for the final a little bit. OK?
Circular linked list A circular linked list is a linear linked list accept that last element points to the first element.
Lists1 © 2010 Goodrich, Tamassia. Position ADT  The Position ADT models the notion of place within a data structure where a single object is stored 
CHAPTER 10.1 BINARY SEARCH TREES    1 ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
CH 1-4 : INTRODUCTION ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND.
Linked List, Stacks Queues
Lecture 6 of Computer Science II
Unit – I Lists.
Lists and Iterators 5/3/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Skip Lists 5/10/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M.
Iterators and Sequences
Data Structure By Amee Trivedi.
Vectors 5/31/2018 9:25 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
Ch7. List and Iterator ADTs
Lectures linked lists Chapter 6 of textbook
Sequences 6/3/2018 9:11 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Doubly Linked Lists 6/3/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Linked List Stacks, Linked List Queues, Dequeues
Linked Lists Linked Lists 1 Sequences Sequences 07/25/16 10:31
Problems with Linked List (as we’ve seen so far…)
EEL 4854 IT Data Structures Linked Lists
Skip Lists S3 + - S2 + - S1 + - S0 + -
Lists.
Lists and Sequences 9/21/2018 7:21 PM Sequences Sequences
LINKED LISTS CSCD Linked Lists.
Linked Lists.
Lists.
Ch7. List and Iterator ADTs
Lists and Iterators 3/9/15 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Sequences 11/22/2018 3:25 AM Doubly-Linked Lists Doubly-Linked Lists.
Sequences 11/27/2018 1:37 AM Singly Linked Lists Singly Linked Lists.
" A list is only as strong as its weakest link. " - Donald Knuth
Lists and Sequences 12/8/2018 2:26 PM Sequences Sequences
11-3 LINKED LISTS A linked list is a collection of data in which each element contains the location of the next element—that is, each element contains.
CS212D: Data Structures Week 5-6 Linked List.
CS2013 Lecture 4 John Hurley Cal State LA.
Lists CSE 373 Data Structures.
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
Problem Understanding
Recall What is a Data Structure Very Fundamental Data Structures
Linked Lists & Iterators
Linked Lists.
Lists CSE 373 Data Structures.
Linked Lists.
Arrays © 2014 Goodrich, Tamassia, Goldwasser Arrays Vectors
Chapter 9 Linked Lists.
Jyh-Shing Roger Jang (張智星) CSIE Dept, National Taiwan University
Problem Understanding
Presentation transcript:

Doubly Linked Lists or Two-way Linked Lists 12/8/2018 Doubly Linked Lists or Two-way Linked Lists © 2014 Goodrich, Tamassia, Goldwasser Doubly Linked Lists

Doubly Linked List (or Two-way Linked List) A doubly linked list can be traversed forward and backward Nodes store: element link to the previous node link to the next node Special trailer and header nodes prev next element node trailer header nodes/positions elements © 2014 Goodrich, Tamassia, Goldwasser Doubly Linked Lists

Header and trailer Make implementation easier Every insertion/deletion is between two nodes Can be implemented without them Save space Need to consider special cases at the beginning and at the end © 2014 Goodrich, Tamassia, Goldwasser Doubly Linked Lists

Insertion p A B C p q A B C What are the instructions? X p q A B X C Insert a new node, q, between p and its successor. p A B C p q A B C What are the instructions? X p q A B X C © 2014 Goodrich, Tamassia, Goldwasser Doubly Linked Lists

Deletion (don’t forget to deallocate the deleted node) Remove a node, p, from a doubly linked list. A B C D p A B C p What are the instructions? D A B C © 2014 Goodrich, Tamassia, Goldwasser Doubly Linked Lists

== (equality) struct Person person1, person2; What is the difference between person1 == person2 Person3 == person4 © 2014 Goodrich, Tamassia, Goldwasser Doubly Linked Lists