Question: Write a class to support the set operations. Each set will be represented by three identifiers that is: int arr [ ] : An array
Write a class to support the set operations.
Each set will be represented by three identifiers that is:
int arr : An array of integers treated as set.
const int capacity: it will store total size of array created above.
int size: it will store number of Elements stored in set.
Functions:
bool addElement int element;
Details: This function adds the element in set and returns true. If element is already present return false.
bool removeElement int element;
Details: This function will remove one element from the set if it is present. return true if element is
removed otherwise false.
bool searchElement int element;
Details: This function will search the given element in set and return true if it is present.
int searchElementPosition int element;
Details: This function will search the given element in set and return its position.
bool isEmpty;
Details: This function will return true if the set is empty.
bool isFull;
Details: This function will return true if the set is full.
void displaySet ;
Details: This function will display the elements of set.
void displayPowerSet ;
Details: This function will display the power set ie all the possible subsets of the given function.
void createClone int targetSet, int& size;
Details: This function will create a copy of the set in targetSet variable.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
