• 2025-12-14
C++如何使用优先队列(priority_queue)?(堆数据结构)

C++中priority_queue默认为最大堆,top()返回最大元素;要实现最小堆需指定std::greater比较器;仅支持堆顶访问和增删,不支持遍历与修改。...

11