Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** @file Node.h Listing 4-1 */ #ifndef _NODE #define _NODE template class Node { private: ItemType item; // A data item Node * next; //

/** @file Node.h

Listing 4-1 */

#ifndef _NODE

#define _NODE

template

class Node

{

private:

ItemType item; // A data item

Node* next; // Pointer to next node

public:

Node();

Node(const ItemType& anItem);

Node(const ItemType& anItem, Node* nextNodePtr);

void setItem(const ItemType& anItem);

void setNext(Node* nextNodePtr);

ItemType getItem() const ;

Node* getNext() const ;

};

The following will need to be modified:

- Node.h: add member variable Node* prev which points to previous node in linked list (or NULL for the first node in list)

- Node.h: add setPrev(), getPrev() prototypes, these are setter and getter functions for prev pointer

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

Public Finance And Public Policy

Authors: Jonathan Gruber

7th Edition

1319281109, 9781319281106

Students also viewed these Databases questions