In C++, what's the quickest way (or decent way) to check each element in a string vector of size approx. 800,000 to see if it's in another string vector of approx. size 200,000? My goal is to push all the strings of the first that are found in the second into a third.
My beginner attempt is never going to stop running:
vector<string> combosVsWords(vector<string> words, vector<string> lettercombos)
{
vector<string> firstwords;
for (int i = 0; i != lettercombos.size(); i++)
{
if (find(words.begin(), words.end(), lettercombos[i]) != words.end())
firstwords.push_back(lettercombos[i]);
}
}