Question
c++ assignment, need urgent solution !! Q - Student is to implement a RandomNumberSet class that will store 5 numbers in the range of 1
c++ assignment, need urgent solution !!
Q - Student is to implement a RandomNumberSet class that will store 5 numbers in the range of 1 to N and number N may be passed at construction time. If default constructor is used N = 39.
The class must store using a bitset or multiple bitsets for efficient implementation of some of the required methods.
The class must support the following methods:
Default Constructor and constructor with range argument.
void reset(); // clears all the numbers stored
bool set(int i); // If number i is not in the set, stored by setting the corresponding bit in the bit set and return true, else return false
int size(); // returns numbers of numbers stored
Overload operator << so that the numbers can be printed out aligned to the right and in 3 spaces
Overload operator - so the difference between two RandomNumberSets can be determined in O(1)
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