#include using namespace std; #ifndef SET_H_ #define SET_H_ class Set { private: /*linked list to hold the set*/ struct Node{ Node *next; long value; }; /*the begging of the set*/ Node *head; long listsize; int a; void quick_sort(long numbers[], long left, long right); void quickSort(long numbers[], long array_size); public: // public interface: Set(); // the default constructor // - initializes the set to empty set Set(long a, long b, long c=1); // initializes the set to the set // containing the elements a, a+c, a+2*c, a+3*c, ... // which are smaller or equal to b Set(long list[],long size); // initializes the set to elements // contained in the array list; the size should be size of the array // (note: you cannot assume that elements in list are all distinct) Set(const Set &s); // the copy constructor ~Set(); // destructor // if the following methods return a reference to Set, // it should be reference to itself (which allows chaining of the operations) Set & operator=(const Set &s); // the assignment operator operator long() const; // return the number of elements bool operator()(long x) const; // return true if x is an element of the set bool operator==(const Set &s) const; // return true if s contains the same elements bool operator<=(const Set &s) const; // return true if this object is subset of s bool operator>=(const Set &s) const; // return true if s is subset of this object Set & operator<<(long x); // add x to the set Set & operator>>(long x); // remove x from the set // (if x is not in the set, do nothing) Set operator+(const Set &s) const; // return the union with the set s Set & operator+=(const Set &s); // add all elements of the set s Set operator*(const Set &s) const; // return the intersection with the set s Set & operator*=(const Set &s); // keep only those elements which are also in s Set operator-(const Set &s) const; // return the set difference with the set s Set & operator-=(const Set &s); // remove those elements which are also in s friend ostream & operator<<(ostream &os, const Set &s); // print the content of the set s }; #endif