Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use it no changed //IntList.j #ifndef INTLIST_H #define INTLIST_H #include using namespace std; struct IntNode { int data; IntNode* next; IntNode(int data) : data(data), next(0)

image text in transcribed

image text in transcribed

use it no changed

//IntList.j

#ifndef INTLIST_H #define INTLIST_H

#include

using namespace std;

struct IntNode { int data; IntNode* next; IntNode(int data) : data(data), next(0) { } };

class IntList {

protected:

IntNode *head; IntNode *tail;

public:

IntList(); IntList(const IntList &); IntList & operator=(const IntList &); ~IntList(); bool empty() const; void display() const; void push_front(int); void push_back(int); void pop_front(); void selection_sort(); void insert_ordered(int); void remove_duplicates(); void clear(); friendostream & operator

private:

// Used by selection_sort function. // Just have this function return nullptr if you don't use this function. IntNode * min(IntNode*); // Used by copy constructor and/or copy assignment operator. // Just implement an empty function if you don't use this function. void copy(const IntList &); };

#endif

Implement a SortedSet class that is a specialization of the IntList class you implemented for PROGRAM 5 IntList class The only change to the IntList class from PROGRAM 5 is to change the access privileges of the data fields from private to protected. You may not change or add anything else to the IntList class. If you did not get 100% on the IntList class, you should fix this class first so that you do get 100% on it before going on to the SortedSet class SortedSet class A set is a collection of unique values. That is, a list that does not have any duplicates. In our case, we will also keep the list sorted (ascending order), so our type will be SortedSet. Our SortedSet is a specialization of the IntList you designed for PROGRAM 5, so your SortedSet class will inherit from the IntList class You are required to come up with a separate header file (h) and separate implementation file (cpp) for the Sortedet class. You should also come up with your own test harness to test just the functions you are currently working on while you are developing the SortedSet class Never implement more than 1 or 2 member functions without fulling testing them with your own test harness. Then, you should submit to zyBooks to get feedback from zyBooks on that function. Please submit your code to zyBooks after each function implementation rather than posting your entire program at the end. Constructors & Destructor SortedSet): The default constructor initializes an empty set SortedSet(const SortedSet 8): The copy constructor initializes the set to be a copy of the set passed in. Use the IntList copy constructor SortedSet(const IntList 8): A constructor that is passed an IntList instead of a SortedSet. It should initialize the set using the values in the IntList. Again, you can use the IntList copy constructor and then remove all of the duplicates and sort the remaining values .SortedSet): The destructor needs to deallocate all dynamically allocated memory that the IntList destructor will not already deallocate. You may very well find that this function does not need to do anything

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

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

ISBN: 1680838482, 978-1680838480

More Books

Students also viewed these Databases questions

Question

6. Conclude with the same strength as in the introduction

Answered: 1 week ago

Question

7. Prepare an effective outline

Answered: 1 week ago