Not clear of concept

i am using priority queue of pair in which 1st number is value and 2nd number is its frequency, and don’t know how to update frequency of a number in the priority queue. please tell

@Akshita99 because of this problem, priority queue is not fair data structure to tackle this problem. Try thinking of some algo using set/hashmap.

sir i even tried using maps, but there i was not able to include my own comparator which can store them based on both first and second values


you can refer to my code,I did it using set(to maintain required order) and map(to keep frequency)