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.

Slides:



Advertisements
Similar presentations
Chapter 22 Implementing lists: linked implementations.
Advertisements

Linked Lists.
Main Index Contents 11 Main Index Contents Shifting blocks of elements… Shifting blocks of elements… Model of a list object… Model of a list object… Sample.
Lists and the Collection Interface Chapter 4. Chapter Objectives To become familiar with the List interface To understand how to write an array-based.
Linked Lists Linked Lists Representation Traversing a Linked List
Data Structures Using C++
CHP-5 LinkedList.
CSE Lecture 12 – Linked Lists …
Chapter 17 Linked List Saurav Karmakar Spring 2007.
M180: Data Structures & Algorithms in Java
Data Structures: A Pseudocode Approach with C
1 Linked Lists Gordon College Prof. Brinton. 2 Linked List Basics Why use? 1.Efficient insertion or deletion into middle of list. (Arrays are not efficient.
1 Chapter 24 Lists Stacks and Queues. 2 Objectives F To design list with interface and abstract class (§24.2). F To design and implement a dynamic list.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
Lists and the Collection Interface Chapter 4. Chapter 4: Lists and the Collection Interface2 Chapter Objectives To become familiar with the List interface.
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.
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Chapter 3: Arrays, Linked Lists, and Recursion
Data Structures Using C++ 2E
CSE 131 Computer Science 1 Module 9: Linked Lists Using references to link objects Basic operations on linked lists Implementing a linked list of integers.
Data Structures Using Java1 Chapter 4 Linked Lists.
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are created using the class definition. Programming techniques.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Kovács Zita 2014/2015. II. félév DATA STRUCTURES AND ALGORITHMS 26 February 2015, Linked list.
Linked List by Chapter 5 Linked List by
Review 1 Polish Notation Prefix Infix Postfix Precedence of Operators Converting Infix to Postfix Evaluating Postfix.
Data Structures Using C++1 Chapter 5 Linked Lists.
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.
1 Data Organization Example 1: Heap storage management –Keep track of free chunks of memory Example 2: A simple text editor –Maintain a sequence of lines.
List Interface and Linked List Mrs. Furman March 25, 2010.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
Data Structures Doubly and Circular Lists Lecture 07: Linked Lists
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
Queue, Deque, and Priority Queue Implementations Chapter 23.
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.
DATA STRUCTURE & ALGORITHMS CHAPTER 2: LINKED LIST.
Chapter 17: Linked Lists. Objectives In this chapter, you will: – Learn about linked lists – Learn the basic properties of linked lists – Explore insertion.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
1 Linked List. Outline Introduction Insertion Description Deletion Description Basic Node Implementation Conclusion.
Linked List. LINKED LIST Link is collection of similar type of elements. There are two ways of maintaining a list in memory. The first way is store the.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists.
Arrays, Link Lists, and Recursion Chapter 3. Sorting Arrays: Insertion Sort Insertion Sort: Insertion sort is an elementary sorting algorithm that sorts.
Data Structure and Algorithm: CIT231 Lecture 6: Linked Lists DeSiaMorewww.desiamore.com/ifm1.
LINKED LISTS.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Copyright © 2012 Pearson Education, Inc. Chapter 17: Linked Lists.
1 Data Organization Example 1: Heap storage management Maintain a sequence of free chunks of memory Find an appropriate chunk when allocation is requested.
Linked Lists Source: presentation based on notes written by R.Kay, A. Hill and C.Noble ● Lists in general ● Lists indexed using pointer arrays ● Singly.
Chapter 16: Linked Lists.
Linked List ADT used to store information in a list
C++ Programming:. Program Design Including
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.
CMSC202 Computer Science II for Majors Lecture 12 – Linked Lists
Data structures and algorithms
CS 1114: Implementing Search
UNIT-3 LINKED LIST.
A Doubly Linked List There’s the need to access a list in reverse order prev next data dnode header 1.
Linked List Sudeshna Sarkar.
Chapter 18: Linked Lists.
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.
Problem Understanding
Chapter 17: Linked Lists.
Data Structures & Algorithms
BY PROF. IRSHAD AHMAD LONE.
Chapter 9 Linked Lists.
Problem Understanding
Presentation transcript:

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 List (LL) nodesLinked List (LL) nodes (2 slides) Linked List (LL) nodes Node Composition Node Composition Inserting at the Front of a LL Inserting at the Front of a LL Deleting from the Front of a LL Deleting from the Front of a LL Removing a Target Node Removing a Target Node Chapter 9 – Linked Lists Handling the Back of the List Handling the Back of the List Designing a New LL Structure Designing a New LL Structure Inserting a Node at a Position Inserting a Node at a Position (2 slides) Circular Doubly LL’sCircular Doubly LL’s (2 slides) Circular Doubly LL’s Updating a Doubly LL Updating a Doubly LL Summary SlidesSummary Slides (5 slides) Summary Slides

Main Index Contents 2 Abstract Model of a List Object

Main Index Contents 33 Main Index Contents Insertion Into a List by Shifting Vector Storage Elements

Main Index Contents 44 Main Index Contents Linked List Nodes Each Node is like a piece of a chain To insert a new link, break the chain at the desired location and simply reconnect at both ends of the new piece.

Main Index Contents 55 Main Index Contents Linked List Nodes Removal is like Insertion in reverse.

Main Index Contents 66 Main Index Contents Node Composition An individual Node is composed of two parts, a Data field containing the data stored by the node, and a Pointer field that marks the address of the next Node in the list.

Main Index Contents 77 Main Index Contents Inserting at the Front of a Linked List

Main Index Contents 88 Main Index Contents Deleting From the Front of a Linked List

Main Index Contents 99 Main Index Contents Removing a Target Node

Main Index Contents 10 Main Index Contents Handling the Back of the List

Main Index Contents 11 Main Index Contents Designing a New Linked List Structure

Main Index Contents 12 Main Index Contents Inserting a Node at a Position

Main Index Contents 13 Main Index Contents Inserting a Node at a Position

Main Index Contents 14 Main Index Contents Circular Doubly Linked Lists A Watch Band provides a good Real Life analogue for this Data Structure

Main Index Contents 15 Main Index Contents Circular Doubly Linked Lists Implemented on a Computer it might look something like this.

Main Index Contents 16 Updating a Doubly Linked List

Main Index Contents 17 Main Index Contents Summary Slide 1 §- singly linked lists -Each node contains a value and a pointer to the next node in the list. -The list begins with a pointer to the first node of the list and terminates when a node has a NULL pointer.

Main Index Contents 18 Main Index Contents Summary Slide 2 §- Inserting/Deleting at the front of a singly linked list 1)Insert -Set the pointer in the new node to the previous value of front. -update front to point at the new node. 2)Erase -assign front the pointer value of the first node, and then delete the node.

Main Index Contents 19 Main Index Contents Summary Slide 3 §- Inserting/Erasing inside a singly linked list -Maintain a pointer to the current list node and a pointer to the previous node. -Change the pointer value in the previous node.

Main Index Contents 20 Main Index Contents Summary Slide 4 §- Insert/Delete at the back of a singly linked list -Maintain a pointer to the last list node that has value NULL when the list is empty. -Assign a “back” pointer the address of the first node added to the list. -To add other nodes at the back: 1)allocate a new node 2)assign the pointer in node “back” to point to the new node 3)assign the pointer “back” the address of the new node.

Main Index Contents 21 Main Index Contents Summary Slide 5 §- Doubly linked lists -provide the most flexible implementation for the sequential list. §- Its nodes have pointers to the next and the previous node, so the program can traverse a list in either the forward or backward direction. -Traverse a list by starting at the first node and follow the sequence of next nodes until you arrive back at the header. -To traverse a list in reverse order, start at the last node and follow the sequence of previous nodes until arriving back at the header.