C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.

Slides:



Advertisements
Similar presentations
TK1924 Program Design & Problem Solving Session 2011/2012
Advertisements

Linked Lists Geletaw S..
Linked Lists.
Data Structures: A Pseudocode Approach with C
DATA STRUCTURES USING C++ Chapter 5
Linked Lists Linked Lists Representation Traversing a Linked List
Data Structures Using C++
Data Structure Lecture-3 Prepared by: Shipra Shukla Assistant Professor Kaziranga University.
Chapter 17 Linked List Saurav Karmakar Spring 2007.
M180: Data Structures & Algorithms in Java
Foundation of Computing Systems Lecture 2 Linked Lists.
Data Structures: A Pseudocode Approach with C
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear.
Data Structures & Algorithms
C++ Programming: Program Design Including Data Structures, Second Edition Chapter 17: Linked Lists.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
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.
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 20: Binary Trees.
Data Structures Using C++ 2E
Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 19: Searching and Sorting Algorithms.
Data Structures Using Java1 Chapter 4 Linked Lists.
Department of Computer Science Data Structures Using C++ 2E Chapter 5 Linked Lists.
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 17: Linked Lists.
Lists Chapter 8. 2 Linked Lists As an ADT, a list is –finite sequence (possibly empty) of elements Operations commonly include: ConstructionAllocate &
Linked List Chapter Data Abstraction separates the logical properties of a data type from its implementation LOGICAL PROPERTIES – What are the.
Linked List by Chapter 5 Linked List by
Subject Name : Data Structure Using C Title : Linked Lists
Data Structures Using C++1 Chapter 5 Linked Lists.
CS2006- Data Structures I Chapter 5 Linked Lists III.
Linked Lists Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 17 © 2002 Addison Wesley.
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,
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists (part 2)
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists (part 2)
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists (part 3)
Department of Computer Science 1 Some Practice Let’s practice for the final a little bit. OK?
 Array is a data structure were elements are stored in consecutive memory location.in the array once the memory is allocated.it cannot be extend any more.
Circular linked list A circular linked list is a linear linked list accept that last element points to the first element.
CS162 - Topic #7 Lecture: Dynamic Data Structures –Review of pointers and the new operator –Introduction to Linked Lists –Begin walking thru examples of.
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:
Data Structure & Algorithms
1 CS 132 Spring 2008 Chapter 5 Linked Lists p
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.
CHAPTER 51 LINKED LISTS. Introduction link list is a linear array collection of data elements called nodes, where the linear order is given by means of.
Topics Covered: File Components of file Components of file Terms used Terms used Types of business file Types of business file Operations on file Operations.
  A linked list is a collection of components called nodes  Every node (except the last one) contains the address of the next node  The address of.
UNIT-II Topics to be covered Singly linked list Circular linked list
LINKED LISTS.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
Chapter 16: Linked Lists.
Linked List ADT used to store information in a list
C++ Programming:. Program Design Including
Linked List :: Basic Concepts
CSCI-255 LinkedList.
Review Deleting an Element from a Linked List Deletion involves:
Prepared by, Jesmin Akhter, Lecturer, IIT, JU
UNIT-3 LINKED LIST.
Linked lists.
Chapter 20: Binary Trees.
Chapter 21: Binary Trees.
Linked List Functions.
Linked Lists.
Linked lists.
Linked Lists Chapter 5 (continued)
CMPT 225 Lecture 5 – linked list.
Presentation transcript:

C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists

Video List This program requires us to −Maintain a list of all videos in the store −Add a new video to our list Use a linked list to create a list of videos

Part 2: Customer Component Primary characteristics of a customer: −First name −Last name −Account number −List of rented videos

Basic Operations Basic operations on personType : −Print the name −Set the name −Show the first name −Show the last name

Basic Operations (continued) Basic operations on an object of the type customerType are: −Print name, account #, and number of rentals −Set name, account #, and number of rentals −Rent a video, add video to the list −Return a video, delete video from the list −Show account #

Main Program The data in the input file is in the form: video title movie star1 movie star2 movie producer movie director movie production co. number of copies.

Algorithm of the Main Function Open the input file, exit if not found createVideoList: create the list of videos displayMenu: show the menu While not done, perform various tasks

CreateVideoList 1.Read data and store in a video object 2.Insert video in list 3.Repeat steps 1 and 2 for each video in file

displayMenu Select one of the following 1.Check whether a particular video is in the store 2.Check out a video 3.Check in a video 4.Check whether a particular video is in the store 5.Print the titles of all videos 6.Print a list of all videos 9.Exit

Summary A linked list is a list of items (nodes) Order of the nodes is determined by the address, called a link, stored in each node The pointer to a linked list is called head or first A linked list is a dynamic data structure The list length is the number of nodes

Summary (continued) Insertion and deletion does not require data movement; only the pointers are adjusted A (single) linked list is traversed in only one direction Search of a linked list is sequential The head pointer is fixed on first node Traverse: use a pointer other than head

Summary (continued) Doubly linked list −Every node has two links: next and previous −Can be traversed in either direction −Item insertion and deletion require the adjustment of two pointers in a node A linked list in which the last node points to the first node is called a circular linked list.