Is there an easy way to make a min heap in C++?

后端 未结 2 423
长发绾君心
长发绾君心 2020-12-14 02:43

I\'m very new to C++, and I was wondering if there was a way to make a min heap in C++ from the standard library.

2条回答
  •  醉酒成梦
    2020-12-14 03:37

    You can use std::make_heap, std::push_heap, and others directly, or you can use a std::priority_queue built on a std::vector or similar.

    The std::*_heap methods are in , and the std::priority_queue template is in .

提交回复
热议问题