Question: what is difference between priority queue and set?
Answer: A priority queue also allows duplicate elements, so it's more like a multiset than a set. ... A set allows you full access in sorted order, so you can, for example, find two elements somewhere in the middle of the set, then traverse in order from one to the other.