What is wrong in my code?

sir, please see my code it is not running. i have made a frequency map. link:https://ide.codingblocks.com/s/287554

@khushi91200 map by default stores its key in sorted order so no need to use cmp inside map.

sir if key is string and i want to make a comparion on the basis of length then?

@khushi91200 you cannot sort map as per your requirements as they are sorted by some internal order.but if you just need to print it in sorted order that you can do by storing value of map in a vector of pair and then sort the vector.

sir, i wrote this code of priority queue but i could not write comparator here, but through structure it is working(written in comments) why? link:https://ide.codingblocks.com/s/288080

yeah we cannot simply use cmp function while decalring priority queue. we need to use use class() or operator() for it.

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.