logo Use CA10RAM to get 10%* Discount.
Order Nowlogo

Assignment #9 TestSet.cpp if you do want debugging statements, comment out the next statement #define NDEBUG

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

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;

}

 

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

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. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

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

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

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

. 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 Sea Ports. Here are the classes and their instance variables we wish to define:

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

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

605 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

770 Answers

Hire Me
expert
Husnain SaeedComputer science

562 Answers

Hire Me
expert
Atharva PatilComputer science

772 Answers

Hire Me

Get Free Quote!

280 Experts Online