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

My EBSCOhost Tutorial Tutorial support.ebsco.com.
Lists CS 3358.
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++
CHP-5 LinkedList.
Data Structures Lecture 13: QUEUES Azhar Maqsood NUST Institute of Information Technology (NIIT)
Chapter 17 Linked List Saurav Karmakar Spring 2007.
Foundation of Computing Systems Lecture 2 Linked Lists.
Review Learn about linked lists
Chapter Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
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.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
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, Fifth Edition Chapter 17: Linked Lists.
Chapter 3: Arrays, Linked Lists, and Recursion
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 18: Stacks and Queues (part 3)
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.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Linked List Chapter Data Abstraction separates the logical properties of a data type from its implementation LOGICAL PROPERTIES – What are the.
Subject Name : Data Structure Using C Title : Linked Lists
Data Structures Using C++1 Chapter 5 Linked Lists.
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,
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.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists (part 2)
CHAPTER 17 LINKED LISTS. In this chapter, you will:  Learn about linked lists  Become aware of the basic properties of linked lists  Explore the insertion.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists (part 2)
1 Algorithms Queues, Stacks and Records stored in Linked Lists or Arrays.
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.
Give Eg:? Queues. Introduction DEFINITION: A Queue is an ordered collection of element in which insertions are made at one end and deletions are made.
Chapter 17: Linked Lists. Objectives In this chapter, you will: – Learn about linked lists – Learn the basic properties of linked lists – Explore insertion.
Data Structures AZHAR MAQSOOD NUST Institute of Information Technology (NIIT) Lecture 6: Linked Lists Linked List Basics.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
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.
UNIT-II Topics to be covered Singly linked list Circular linked list
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
Using the My EBSCOhost Folder Tutorial support.ebsco.com.
1 Data Organization Example 1: Heap storage management Maintain a sequence of free chunks of memory Find an appropriate chunk when allocation is requested.
Chapter 16: Linked Lists.
Linked List ADT used to store information in a list
Unit – I Lists.
C++ Programming:. Program Design Including
Sorted Linked List Same objective as a linked list, but it should be sorted Sorting can be custom according to the type of nodes Offers speedups over non-sorted.
Linking in double direction
Chapter 15 Lists Objectives
CS Data Structures Chapter 8 Lists Mehmet H Gunes
Pointers and Linked Lists
Chapter 15 Lists Objectives
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
Chapter 4 Unordered List.
BY PROF. IRSHAD AHMAD LONE.
CMPT 225 Lecture 5 – linked list.
Presentation transcript:

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

Doubly linked list: every node has next and back pointers Can be traversed in either direction

Doubly Linked Lists (continued) Operations: 1.Initialize the list. 2.Destroy the list. 3.Determine whether the list is empty. 4.Search the list for a given item. 5.Retrieve the first element of the list. 6.Retrieve the last element of the list. 7.Insert an item in the list. 8.Delete an item from the list. 9.Find the length of the list. 10.Print the list. 11.Make a copy of the doubly linked list.

Both cases 1 and 2 require us to change the value of the pointer first. Cases 3 and 4 are similar. After inserting an item, count is incremented by 1. Next, we show Case 4.

After deleting a node, count is decremented by 1. Let us demonstrate Case 3.

Operations on a circular list are: 1.Initialize the list (to an empty state). 2.Determine if the list is empty. 3.Destroy the list. 4.Print the list. 5.Find the length of the list. 6.Search the list for a given item. 7.Insert an item in the list. 8.Delete an item from the list. 9.Copy the list.

Programming Example A new video store in your neighborhood is about to open However, it does not have a program to keep track of its videos and customers The store managers want someone to write a program for their system so that the video store can operate

Programming Example (continued) The program should be able to perform the following operations: −Rent a video; that is, check out a video −Return, or check in, a video −Create a list of videos owned by the store −Show the details of a particular video −Print a list of all videos in the store −Check whether a particular video is in the store −Maintain a customer database −Print list of all videos rented by each customer

Programming Example (continued) There are two major components of the video store: −A video −A customer You need to maintain two lists: 1.A list of all videos in the store 2.A list of all customers of the store

Part 1: Video Component (continued) The common things associated with a video are: −Name of the movie −Names of the stars −Name of the producer −Name of the director −Name of the production company −Number of copies in store