Linked Lists with Tail Pointers

Slides:



Advertisements
Similar presentations
JAVA & Linked List Implementation
Advertisements

418115: II. Linked List A linked list can be thought of a chain of linked list elements. A linked list element contains a single data item, and contains.
Data Structure Lecture-5
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are crated using the class definition. Programming techniques.
Linked List Improvements & Memory. BigO's What is BigO for our basic linked list operations? InsertStart Insert at middle InsertEnd Retrieve First Value.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition Chapter 17: 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.
Rossella Lau Lecture 3, DCO20105, Semester A, DCO Data structures and algorithms  Lecture 3: Basics of Linked List  C++ pointer revision.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 17 Linked.
Insertion into a B+ Tree Null Tree Ptr Data Pointer * Tree Node Ptr After Adding 8 and then 5… 85 Insert 1 : causes overflow – add a new level * 5 * 158.
CS 206 Introduction to Computer Science II 09 / 19 / 2008 Instructor: Michael Eckmann.
Self Referential Structure. A structure may not contain a member of its own type. struct check { int item; struct check n; // Invalid };
Week 3 - Wednesday.  What did we talk about last time?  Started linked lists.
Scott Grissom, copyright 2004 Ch 6 Data Structures Slide 1 Linear Data Structures Chapter 6 focuses on: Lists Stacks Queues You can skip the Array implementation.
Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy Walters, and Godfrey Muganda Chapter 17: Linked Lists.
© 2014 Goodrich, Tamassia, Goldwasser Singly Linked Lists1 Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition,
1 Today’s Material List ADT –Definition List ADT Implementation: LinkedList.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
CSC 205 Programming II Lecture 15 Linked List – Other Variations.
1 What is a Circular Linked List? l A circular linked list is a list in which every node has a successor; the “last” element is succeeded by the “first”
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
CS162 - Topic #9 Lecture: Dynamic Data Structures –Deallocating all nodes in a LLL –Inserting nodes into sorted order Programming Assignment Questions.
PLUS.
CSCI-255 LinkedList.
UNIT – I Linked Lists.
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,
Linked List Stacks, Linked List Queues, Dequeues
Abstract Data Types Polynomials CSCI 240
COP3530- Data Structures Advanced Lists
Traversing a Linked List
Sequences 8/2/ :16 AM Linked Lists Linked Lists.
Linked list insertion Head. Linked list insertion Head.
Linked Lists with Tail Pointers
Doubly linked lists.
Topic 16 Queues Adapted from Mike Scott’s materials.
Linked Lists.
Dummy Nodes, Doubly Linked Lists and Circular Linked Lists
Database Linked List Representation
CS 2308 Exam II Review.
Evaluation of List Implementations
Circularly Linked Lists
CS 2308 Exam II Review.
CS 2308 Exam II Review.
Practice Test – Linked Lists
Linked Lists: Implementation of Queue & Deque
كيــف تكتـب خطـة بحـث سيئـة ؟؟
الدكتـور/ عبدالناصـر محمـد عبدالحميـد
Lecture 20 Linked Lists Richard Gesick.
Queue and Priority Queue Implementations
Chapter 14: Queue and Priority Queue Implementations
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
A List Implementation That Links Data
Recursive Linked List Operations
Recursive Linked Lists
LINKED LISTS.
Evaluation of List Implementations
Lecture 16 Section 6.2 Thu, Mar 1, 2007
CS148 Introduction to Programming II
Queues Lecture 30 Fri, Apr 2, /3/2019 Queues.
List Iterator Implementation
Instructor: Dr. Michael Geiger Spring 2019 Lecture 29: Linked queues
Recursive Linked Lists
Linked Lists.
Recursive Linked Lists
Similarities Differences
CS148 Introduction to Programming II
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Linked List Improvements
A List Implementation That Links Data
Presentation transcript:

Linked Lists with Tail Pointers Lecture 20 Fri, Mar 5, 2004

Topics Linked Lists with Tail Pointer Validity Requirements

Linked Lists with Tail Pointers A linked list with tail pointer is a linked list with one additional pointer that points to the last node in the list. The name of the class is LinkedListwTail. One additional data member LinkedListNode* tail - A pointer to the last node in the list.

Implementing the Member Functions The LinkedListwTail class is very similar to the LinkedList class. Rewrite only those functions that involve the tail pointer. PushBack() becomes much more efficient. Use a linked list with tail pointer in applications that make extensive use of PushBack().

Validity Requirements All the requirements of a LinkedList, plus If size == 0, then tail == NULL If size > 0, then tail == ptr, where ptr is a pointer to the last node.