Circularly Linked Lists

Slides:



Advertisements
Similar presentations
Data Structures ADT List
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 17 Linked List Saurav Karmakar Spring 2007.
Comparison summary Array based (dynamic) Keeps place for up to 4N elements Each element takes 1 memory places Fast accession time Slow removals and insertion.
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.
Data Structures Topic #3. Today’s Agenda Ordered List ADTs –What are they –Discuss two different interpretations of an “ordered list” –Are manipulated.
CS 206 Introduction to Computer Science II 09 / 19 / 2008 Instructor: Michael Eckmann.
Chapter 17 Linked List.
Linked List Chapter Data Abstraction separates the logical properties of a data type from its implementation LOGICAL PROPERTIES – What are the.
Review 1 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix Evaluating Postfix.
Data Abstraction and Problem Solving with JAVA Walls and Mirrors Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Data Abstraction and Problem.
CS2006- Data Structures I Chapter 5 Linked Lists III.
1 Today’s Material List ADT –Definition List ADT Implementation: LinkedList.
COMPSCI 105 SS 2015 Principles of Computer Science
Data Structures Doubly and Circular Lists Lecture 07: Linked Lists
Lab - 11 Keerthi Nelaturu. Ordered Structure Using Doubly linked list All elements in the list are arranged in an order Implement the Ordered Structure.
2/21/20161 List Operations Advanced Programming Ananda Gunawardena.
Data Abstraction and Problem Solving with C++ Walls and Mirrors, Third Edition, Frank M. Carrano and Janet J. Prichard ©2002 Addison Wesley CHAPTER 4 Linked.
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”
CS162 - Topic #7 Lecture: Dynamic Data Structures –Review of pointers and the new operator –Introduction to Linked Lists –Begin walking thru examples of.
Lecture 16 Linked Lists. In this lecture Fundamentals Applications Memory Allocation Creating a List Inserting Nodes.
Doubly Linked List Exercises Sometimes it is useful to have a linked list with pointers to both the next and previous nodes. This is called a doubly linked.
Lists List Implementations. 2 Linked List Review Recall from CMSC 201 –“A linked list is a linear collection of self- referential structures, called nodes,
CC 215 DATA STRUCTURES LINKED LISTS Dr. Manal Helal - Fall 2014 Lecture 3 AASTMT Engineering and Technology College 1.
1 Linked List. List vs Arrays Two built-in data structures that can be used to organize data, or to create other data structures: Lists Arrays.
CPSC 252 Linked Lists III Page 1 Variations on Singly Linked Lists Inserting or deleting at the front of a list is different from at any other point in.
One implementation of the LIST ADT Insert new node before current and new node becomes current (assume new node created) node newNode = new node; head.
Lecture 6 of Computer Science II
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,
CMSC202 Computer Science II for Majors Lecture 12 – Linked Lists
Linked List Stacks, Linked List Queues, Dequeues
Linked Lists Linked Lists 1 Sequences Sequences 07/25/16 10:31
Abstract Data Types Polynomials CSCI 240
Doubly Linked List Review - We are writing this code
Data Structures and Algorithms
CSE 143 Linked Lists [Chapter , 8.8] 3/30/98.
Sequences 8/1/2018 4:38 AM Linked Lists Linked Lists.
Chapter 4 Linked Lists.
Linked List Variations
Algorithm for deleting a node from a singly linked list
EEL 4854 IT Data Structures Linked Lists
ENERGY 211 / CME 211 Lecture 12 October 17, 2008.
Linked Lists with Tail Pointers
Prof. Neary Adapted from slides by Dr. Katherine Gibson
Dummy Nodes, Doubly Linked Lists and Circular Linked Lists
Evaluation of List Implementations
Linked Lists: Implementation of Queue & Deque
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.
Linked Lists with Tail Pointers
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
Doubly Linked List Implementation
Recursive Linked Lists
Data Structures and Algorithms
Linked Lists Chapter 4.
Chapter 17: Linked Lists.
LINKED LISTS.
Lecture 16 Section 6.2 Thu, Mar 1, 2007
Figure 4.1 a) A linked list of integers; b) insertion; c) deletion.
Instructor: Dr. Michael Geiger Spring 2019 Lecture 29: Linked queues
Recursive Linked Lists
Recursive Linked Lists
Doubly Linked List Implementation
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Linked List Improvements
Linked Lists Chapter 5 (continued)
CMPT 225 Lecture 5 – linked list.
Presentation transcript:

Circularly Linked Lists Lecture 23 Wed, Mar 22, 2006

Topics Circularly linked lists The CircLinkedList class Evaluation of List implementations

Circularly Linked Lists A circularly linked list is a doubly linked list in which one additional node is allocated. Its next and prev pointers are the head and tail pointers of the list. Its data member is not used.

The Data Members A CircLinkedList object has two data members: int size - Number of elements in the list. DoublyLinkedListNode* list - Pointer to the extra (dummy) node.

Circularly Linked List Nodes A CircularlyLinkedList uses DoublyLinkedListNodes. The dummy node is always allocated – even in an empty list.

Benefits of this Implementation The next pointer of the last node points to the dummy node, so it is not null. The prev pointer of the first node points to the dummy node, so it is not null. In fact, none of the pointers in the structure is null. Since there are no null pointers, the code in the member functions contains no special cases!

The CircLinkedList Class doublylinkedlistnode.h circlinkedlist.h ListTest.cpp