![]() |
Which datastructure to use for set of sets
What i want is to first store the given input as follows :-
{{{A,B},{B,C},{C,D}},{{A,C},{C,E},{E,F},{F,P}}} and then make a check if the pair is present in particular subset of a set. For e.g if the user can give index 0 and pair {B,C} we need to search the first index value i.e {{A,B},{B,C},{C,D}} and return true or false based on its presence. What data structure i should use. I tried vector but not helping me Kindly help |
Re: Which datastructure to use for set of sets
My current implementation look like
Code:
|
Re: Which datastructure to use for set of sets
Why did you decide that a set only ever has two elements (a pair)?
|
Re: Which datastructure to use for set of sets
Quote:
Code:
0 1 2 3Depending on what you want to do with it, perhaps a vector of sets of pairs. If your base elements are just single characters you could use chars instead of strings. |
| All times are GMT +5.5. The time now is 20:03. |