We need to come up with a way to store a set, the elements of which can be other sets, in turn, these sets can also have sets and so on.
THE LEVEL OF SUCH INVESTMENTS IS NOT LIMITED !!!!!. I can’t figure out which container is better to use. It is advisable not to suggest classes as I do not own them. But I don’t like my method, it’s too complicated and while I was drawing I got confused, so please tell me how to do it all more rationally.
struct element
{
int key;
element * next;
};
struct mnoz
{
element * el;
mnoz * next;
mnoz * podmn;
};
Answer 1, authority 100%
This is a tree, in principle.
struct Node {
int leaf;
std :: vector & lt; Node & gt; branches;
};
And, in principle, you can think of thousands of implementations.