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:
1. bool addElement (int element);
Details: This function adds the element in set and returns true. If element is already present return false.
2. 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.
3. bool searchElement (int element);
Details: This function will search the given element in set and return true if it is present.
4. int searchElementPosition (int element);
Details: This function will search the given element in set and return its position.
5. bool isEmpty();
Details: This function will return true if the set is empty.
6. bool isFull();
Details: This function will return true if the set is full.
7. void displaySet ();
Details: This function will display the elements of set.
8. void displayPowerSet ();
Details: This function will display the power set i.e., all the possible subsets of the given function.
9. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!