Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do the find _ biggest _ subset _ le function C + + The Representationfasd How do you represent a set internally? At first

Please do the find_biggest_subset_le function C++The Representationfasd
How do you represent a set internally?
At first thought it might seem like a simple problem. The trivial solution is to have each set be a
collection (e.g. a vector) of objects.
While this seems like a simple solution on face value, it can be horribly inefficient. What if I
wanted to make sets of media objects that were each unmanageably large?
A better solution is to store all possible set members, the so-called Universal or Master set,
within the object as a class (static) member. Each instantiated set would then be simply
composed of a collection of integers, which are simply pointers to the actual objects in the
Master set.
This sounds like a good idea. But there's an even better one. With a static master set, you still
have to initialize it by copying over the supplied elements into it. With an understanding that
you will not change the master set, why not have your client (the instantiator of the Set class)
create and maintain the master set as a vector, and you only deal with integer indices into this
(externally maintained) master set?
4
That's the approach we will take in this quest. Although you don't have to code a lot, most of the
time, I presume, may be taken up by simply wrapping your head around this:
The Set object will contain a pointer to an externally maintained vector of elements we
call the master set. This pointer must be set during set initialization.
Each Set object will contain a vector of integers, each of which is an index in the master
set to a valid element contained in that Set. (See Figure 1)class Set 1
private:
vectoraT?;{??
?**
image text in transcribed

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

Know how to conduct a position analysis

Answered: 1 week ago