Hi, this is my assignment. Fill in the code in Set.h and Set.cpp and test in TestSet.cpp
// Student Name:
//
// Assignment #9 by
#include
#include "Set.h"
// if you do want debugging statements, comment out the next statement
#define NDEBUG
// complexity is O(1)
bool Set::isEmpty() const{
}
// complexity is
int Set::size() const {
return length(list);
}
// 1160: must be recursive
int Set::length(Node * p) {
}
// make a new node and put in the value field x and in the next field p
// precondition: none
// postcondition:
// a pointer to the newly created Node is returned
// complexity: O(1)
Set::Node * Set::cons( int x, Node * p ) {
Node * q;
q = new Node;
q->value = x;
q->next = p;
return q;
}
// complexity is
bool Set::member(int x) const {
return member(x, list);
}
bool Set::member(int x, Node * p) {
}
// complexity is
void Set::insert(int x) {
}
// recursive version
// complexity of insertion is
Set::Node* Set::insert(int x, Node* p) {
}
//
// output onto out a list of the form { element0 element 1 ... elementn-1 }
// precondition:
// Set s is a valid, well initialized Set
// complexity of printing the list is O(n) when there are n elements
// in the Set s
std::ostream& operator << (std::ostream& out, const Set& s) {
out << "{ ";
out << "}";
return out;
}
// union of Set a and Set b
// a has m elements and b has n elements: complexity
const Set operator +(const Set & a, const Set & b) {
}
// intersection of Set a and Set b
// a has m elements and b has n elements: complexity
const Set operator *(const Set& a, const Set& b) {
}
// determine if a is a subset of b
bool operator <(const Set& a, const Set& b) {
}
Set::Set(const Set& otherSet) {
#ifndef NDEBUG
cout << "&&&&&&&&&& copy constructor called &&&&&&&&&&&\n";
#endif
}
// destructor
// postcondition:
// every Node in the list is deleted and the list is set to nullptr
Set::~Set(){
#ifndef NDEBUG
cout << "called the destructor+++++++++++++++\n";
#endif
}
// overload the assignment operator
Set& Set::operator = (const Set& otherSet) {
#ifndef NDEBUG
cout << "!!!!!!!!!!!!!!!!!!! called the overloaded = operator\n";
#endif
return *this;
}
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of