Question
Objectives: 1. Students will gain an experience to use doubly-linked list to solve a problem. Problem Descriptions: This project consists of two parts. The first
Objectives: 1. Students will gain an experience to use doubly-linked list to solve a problem. Problem Descriptions: This project consists of two parts. The first part is to write a class that implements the ADT Bag using a doubly-linked list with a pointer to its first node. The second part of the project specifies how a program will use the class. Part I In a doubly linked list, each node can point to the previous node as well as to the next node. Figure 4-10 shows a doubly linked list and its head pointer. Define a class DoublyLinkedBag that implements the ADT bag by using a doubly linked list as shown in Figure 4-10.
Requirements 1. First define a class to represent a node in a doubly linked list by modifying the node class we used for linked base implementation of ADT Bag. Test it before you use it for the class DoublyLinkedBag. This node class should have the following data members: A pointer to the next node A pointer to the previous node An item 2. Define and implement class DoublyLinkedBag following the example of the LinkedBag we discussed in the class. a. To be able to run your program on centOS, you must include the class implementation file in the header file DoubleLinkedBag.h as below: ......... #include DoublyLinkedBag.cpp #endif 3. Use the following program to test your ADT Bag implemented by doubly linked list // This program tests the ADT Bag class which is implemented by a doubly // linked list. #include
CSCI 301 Computer Science II Spring 2023 #include CSCI 301 Computer Science II Spring 2023 displayBag(bag); cout bag; cout Transcribed image text
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started