I am not exactly able to code how do I print all the values that will be there in this linkedlist at a particular hash value?
unordered_map<string,list<string>> myhash;
unordered_map<string,list<string>>::iterator it;
for ( i = 0; i < N; i++ )
{
string foo = arr[i];
sort(foo.begin(),foo.end());
myhash[foo] = list.insert(arr[i]); // Is this the correct way of inserting elements in the linked list?
}
for ( i = 0; i < N; i++ )
{
string foo = arr[i];
sort(foo.begin(),foo.end());
it = myhash.find(foo);
if ( it!= myhash.end() )
{
//if the key value is found, I want to print all elements in the linked list present at that key value.
// also, after printing all the elements, I want to delete that key from the hash table.
}
}
So, I have doubts basically in the parts where I have added comments?
im quite confused what you are doing oO
Is that what you are searching for?