plz provide me with the comparator class we should define to solve it using priority queues without using hashing technique
Hint to solve using priority queue
You just need a max heap based on frequency count. If frequency are same you need to take smaller element at the top.
i used the same concept but unable to print required numbers at every stage as we have to pop elements from priority queue at every stage and we cant push them back.I tried it using a temporary queue but not getting correct output.
please provide me with the code of the same
Send your code link so that i can check.