Hash Map
I found hash map to be the most useful data structure when it comes to solving a problem very efficiently.
map<string, int> wordCount;
wordCount.insert({"hello", 1});
auto keyValue = wordCount.find("hello");
if (keyValue == wordCount.end()) {
// not found
}
else {
cout<<" : found : Value : "<<wordCount["hello"]<<endl;
}
//Looping through the map
for (auto pair: wordCount)
{
// Each element in a map is a (key, value) pair
cout << "key:" << pair.first << " , " <<"value:" << pair.second << " ";
}