Jyh-Shing Roger Jang (張智星) CSIE Dept, National Taiwan University

Slides:



Advertisements
Similar presentations
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.
Advertisements

Doubly-linked list library.
Review Learn about linked lists
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.
Linked list More terminology Singly-linked lists Doubly-linked lists DLLs compared to SLLs Circular Lists.
© 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.
CS 206 Introduction to Computer Science II 09 / 17 / 2008 Instructor: Michael Eckmann.
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.
Main Index Contents 11 Main Index Contents Abstract Model of a List Obj. Abstract Model of a List Obj. Insertion into a List Insertion into a List Linked.
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.
Chapter 3: Arrays, Linked Lists, and Recursion
© 2004 Goodrich, Tamassia Sequences and Iterators1.
CSCI 2720 Lists III Eileen Kraemer University of Georgia Spring 2007.
Singly Linked Lists Jyh-Shing Roger Jang ( 張智星 ) CSIE Dept, National Taiwan University 1.
CS 221 Analysis of Algorithms Data Structures Vectors, Lists.
Lecture5: Linked Lists Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
1. Circular Linked List In a circular linked list, the last node contains a pointer to the first node of the list. In a circular linked list,
1 Linked Lists (Lec 6). 2  Introduction  Singly Linked Lists  Circularly Linked Lists  Doubly Linked Lists  Multiply Linked Lists  Applications.
© 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
Introduction Dynamic Data Structures Grow and shrink at execution time Linked lists are dynamic structures where data items are “linked up in a chain”
Lists (2). Circular Doubly-Linked Lists with Sentry Node Head.
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 
Simulation of Stock Trading J.-S. Roger Jang ( 張智星 ) MIR Lab, CSIE Dept. National Taiwan University.
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
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.
Program based on queue & their operations for an application
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
Tries Jyh-Shing Roger Jang (張智星) CSIE Dept, National Taiwan University.
Linked Lists Linked Lists 1 Sequences Sequences 07/25/16 10:31
Linked-list.
Sequences 8/2/ :16 AM Linked Lists Linked Lists.
EEL 4854 IT Data Structures Linked Lists
Lists and Sequences 9/21/2018 7:21 PM Sequences Sequences
LINKED LISTS CSCD Linked Lists.
Sequences and Iterators
Dummy Nodes, Doubly Linked Lists and Circular Linked Lists
Database Linked List Representation
Applications of Stacks and Queues for Constraint Satisfaction Problems
Linked Lists.
Doubly Linked Lists or Two-way Linked Lists
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.
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
Problem Understanding
Chapter 17: Linked Lists.
LINKED LISTS.
Vectors, Lists and Sequences
Circularly Linked Lists and List Reversal
Queues Jyh-Shing Roger Jang (張智星)
Linked Lists & Iterators
Header and Trailer Sentinels
Applications of Heaps J.-S. Roger Jang (張智星) MIR Lab, CSIE Dept.
Insertion Sort Jyh-Shing Roger Jang (張智星)
Examples of Time Complexity
CS210- Lecture 6 Jun 13, 2005 Announcements
CS210- Lecture 7 Jun 14, 2005 Agenda Practice Session Vector
Duration & Pitch Modification via WSOLA
Chapter 9 Linked Lists.
Sorting Algorithms Jyh-Shing Roger Jang (張智星)
Storing Game Entries in an Array
Problem Understanding
Presentation transcript:

Jyh-Shing Roger Jang (張智星) CSIE Dept, National Taiwan University Doubly Linked Lists Jyh-Shing Roger Jang (張智星) CSIE Dept, National Taiwan University

Why Doubly Linked Lists To facilitate efficient insertion and removal at any positions How? By having two links pointing to the previous and the next nodes, respectively

Doubly Linked List A doubly linked list (DLL) allows us to traverse the list in either directions quickly. A node has the following fields element link to the previous node link to the next node Special trailer and header nodes prev next elem node trailer header elements

Insertion after a Node p A B C p q A B C X p q A B X C Operations of insertAfter(p, X) p A B C p q A B C X p q A B X C

Insertion before a Node Operations of insertBefore(v, e)

Deletion Operations of remove(p) A B C D p A B C p D A B C

Example of Generic DLL By using generic DLL, you can put any data of any types into the data part of a node. Example