sir meko samjh ni aaara ki hashmap kaise chal ra hai kuki isme toh hum sirf key bta re hai then yeh value kaise count krra hai and kaise pta lag ra hi ki wo value ko update krte rehna hai
Https://ide.codingblocks.com/s/268723
Frequency map is being maintained using the unordered map in your code.
As you know that in a map, keys are unique.
For the first time you get a key, its count is incremented to 1.
If again you get the same key, its count is incremented to 2 and so on…
hashmap[key] actually means the value at that key.
so hashmap[key]++ means its value gets incremented by 1.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.