Home c++ The set of elements of which are C++ sets

The set of elements of which are C++ sets




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;

 The principle of splitting the set until we get simple elements, in the cells I entered the value of the elements

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.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions