Question
implement the LinkedList ADT [the declaration is given in ListLinked.h] - implement the following operations: - remove, replace, clear; (30 pts) - isFull, isEmpty; (10
implement the LinkedList ADT [the declaration is given in ListLinked.h]
- implement the following operations:
- remove, replace, clear; (30 pts)
- isFull, isEmpty; (10 pts)
- gotoBeginning, gotoEnd, gotoNext, gotoPrior, getCursor; (20 pts)
HERE IS THE GIVEN CODE:
ListLinked.h:
//--------------------------------------------------------------------
//
// Laboratory 5 ListLinked.h
//
// Class declaration for the linked implementation of the List ADT
//
//--------------------------------------------------------------------
#ifndef LISTLINKED_H
#define LISTLINKED_H
#include
#include
using namespace std;
template
class List {
public:
List(int ignored = 0);
List(const List& other);
List& operator=(const List& other);
~List();
void insert(const DataType& newDataItem) throw (logic_error);
void remove() throw (logic_error);
void replace(const DataType& newDataItem) throw (logic_error);
void clear();
bool isEmpty() const;
bool isFull() const;
void gotoBeginning() throw (logic_error);
void gotoEnd() throw (logic_error);
bool gotoNext() throw (logic_error);
bool gotoPrior() throw (logic_error);
DataType getCursor() const throw (logic_error);
// Programming exercise 2
void moveToBeginning () throw (logic_error);
// Programming exercise 3
void insertBefore(const DataType& newDataItem) throw (logic_error);
void showStructure() const;
private:
class ListNode {
public:
ListNode(const DataType& nodeData, ListNode* nextPtr);
DataType dataItem;
ListNode* next;
};
ListNode* head;
ListNode* cursor;
};
#endif
ListLinked.cpp:
#include "ListLinked.h"
// ListNode member functions
template
List
nextPtr)
{
this->dataItem = nodeData;
this->next = nextPtr;
}
// List member functions
template
List
{
}
template
List
{
}
template
List
{
}
template
List
{
}
template
void List
(logic_error)
{
}
template
void List
{
}
template
void List
(logic_error)
{
}
template
void List
{
}
template
bool List
{
return false;
}
template
bool List
{
return false;
}
template
void List
{
}
template
void List
{
}
template
bool List
{
return false;
}
template
bool List
{
return false;
}
template
DataType List
{
DataType t;
return t;
}
template
void List
{
}
template
void List
(logic_error)
{
}
#include "show5.cpp"
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