I am a newbie to algorithms and I am trying to figure out the best possible (in terms of memory efficiency and speed) way to find out if a vector of ints (sample vector) exists in a vector of vector of ints (population vector). I will illustrate the problem using an example.
A={1,2,3,4,5,6,7,8} , These are the vertices of a cube. The six faces that can be formed from it are {1,2,3,4}, {5,6,7,8}, {1,2,6,5}, {2,3,7,6}, {3,4,8,7} {4,1,8,5}
now B={3,4,8,7}. So I have to find if B exists in how many A vectors of the population vector? ( the population vector is made of several As.)
I am using a hash function, comparing its value for B and the 6 vectors of A and running a loop for all vectors of population vector. Is there a better way to do it?