samedi 30 mai 2015

Searching vectors in C++

I need to find whether a vector<unsigned> searchvec; is present in a vector<vector<unsigned> > containerVec;. One way to do the same is to iterate over vector<vector<unsigned> > containerVec; and see whether searchVec is present in containerVec. Is there any build in c++ function which can help me do the same.

Also my searchVec is of size 1 million vector

For example if my searchVec is (9,28,4,2) and my containerVec is ((1,3,678,27),(9,28,4,2), (595,85,52)). Then searchVec (9,28,4,2) is present in ((1,3,678,27),(9,28,4,2), (595,85,52)). However if my searchVec is (23,84,25,11) then it is not present in containerVec.

Aucun commentaire:

Enregistrer un commentaire