Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started