See http://en.cppreference.com/w/cpp/container/priority_queue. A priority_queue is designed to put the largest value at the top. This happens if you use the default std::less comparator. So if you want the reverse behavior, you need to use the reverse comparator, std::greater.