Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Public Finance

Authors: Harvey Rosen, Ted Gayer

10th Global Edition

007715469X, 978-0077154691

Students also viewed these Databases questions

Question

Demand and Supply in Financial Markets

Answered: 1 week ago