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
I will use map of linked-list pointers. So based on index, I will get the list in which I need to search for the pair. The reason behind using linked list is the sets you have shown are having different number of character pairs. And map will allow me to search fast based on the index.