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.
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