摘要:
转载自stl的heap使用 stl中的堆默认是最大堆,要想用最小堆的话,必须要在push_heap,pop_heap,make_heap等每一个函数后面加第三个参数greater<int>(),括号不能省略。 1、make_heap:使序列变成堆 原型: 范例: 2、push_heap:压栈(入栈) 阅读全文
摘要:
转载自stl的heap使用 stl中的堆默认是最大堆,要想用最小堆的话,必须要在push_heap,pop_heap,make_heap等每一个函数后面加第三个参数greater<int>(),括号不能省略。 1、make_heap:使序列变成堆 原型: 范例: 2、push_heap:压栈(入栈) 阅读全文
|