I have a 2D vector, S, and a 1D vector, I. Both S and I contain integers. Here is an example:
vector<int> I={6,2,3,1,4,5,0};
vector<vector<int>> S;
S[0]={0,1,3};
S[1]={1,2,4};
S[2]={4,5,6};
S[3]={0,3,5};
I contains numbers 0..n and vectors S are all subsets of I. I want to sort items in vectors S, with respect to the order of items in I. So that:
S[0]={3,1,0};
S[1]={2,1,4};
S[2]={6,4,5};
S[3]={3,5,0};
My real vectors are large in size, so I need to do it in the most efficient way (in c++).