摘要:
http://www.cplusplus.com/reference/queue/priority_queue/priority_queue 的top始终保持着为一堆数据中的最大元素。读取最小 O(1)插入和删除 lg(n)(真是又简便又好用,难怪g不要我,当时连这个都不会写,sigh...)#in...
阅读全文
摘要:
在C++中,虽然堆不像 vector, set 之类的有已经实现的数据结构,但是在 algorithm.h 中实现了一些相关的模板函数。下面是一些示例应用http://www.cplusplus.com/reference/algorithm/pop_heap/#include #include ...
阅读全文