Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a class DoublyLinkedBag that implements the ADT bag by using a doubly linked chain, as shown in Figure 4-9. Use the class of nodes

image text in transcribed Define a class DoublyLinkedBag that implements the ADT bag by using a doubly linked chain, as shown in Figure 4-9. Use the class of nodes that Exercise 10 defines. Demonstrate your double linked list implementation in a main function. Tips: Unlike the previous assignment (with arrays) we are not using integers as our data - but the ADT bag, which uses templates. It would be best to implement the ADT linked based implementation of bag first. This majority of this code is done for you in the textbook. Then simply modify the LinkedBag code to handle a double linked list.

  • Inputs
    • Modification of the Node class: Constructor/descructor for the new node (w/ a next and prev pointers)
    • Modification of the Node class: addition of setPrev and getPrev Functions
  • Processing
    • Modification of the LinkedBag class: constructors and destructors
    • Modification of the LinkedBag class: add and remove
  • Output
    • main.cpp demonstrates the initialization and destruction of a double linked list.
    • main.cpp demonstrates an addition and removal from the double linked list.
FIGURE 4-9 (a) A linked chain and its (b) shallow copy; (c) deep copy 4 "ab" "cd""ef""gh" i temCount headPtr 4 Copy of i temCount Copy of headPtr Shallow copy 4 ab" "gh" Copy of Copy of Copy of the linked chain i temCount headPtr Deep copy FIGURE 4-9 (a) A linked chain and its (b) shallow copy; (c) deep copy 4 "ab" "cd""ef""gh" i temCount headPtr 4 Copy of i temCount Copy of headPtr Shallow copy 4 ab" "gh" Copy of Copy of Copy of the linked chain i temCount headPtr Deep copy

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find most persuasive? Why?

Answered: 1 week ago