Question: In this exam, you will write a C++ class IntSet that maintains a set of integers and has the following methods: IntSet(), the constructor that

In this exam, you will write a C++ class IntSet that maintains a set of integers and has the following methods:

  • IntSet(), the constructor that creates an empty integer set.
  • int isMember(int i), check if the input integer i is a member of the set, return 1 if it is, otherwise return 0.
  • int insert(int i), insert integer i into the set, return 1 if the insert is successful, and 0 otherwise.
  • int delete(int i), delete integer i from the set, return 1 if i is deleted from the set, and 0 if i is not in the set.
  • void print(), print out all the elements of the set to the screen.
  • IntSet IntSet::union(IntSet S), return the union of this set and the input set S.

IntSet IntSet::intersection(IntSet S), return the intersection of this set and the input set S

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!