Originally Posted by tonyaim83
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.
    0     1     2     3
0 (a,b),(b,c),(c,d)
1 (a,c),(c,e),(e,f),(f,g)
2 (a,b),(a,c),(b,d)
Your data structure seems to be a ragged two-dimensional array of pairs.
Depending 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.