My implementation is based on BinaryHeap,insert's worst-case cost is O(logN) Fibonacci Heap's insert amortized cost is O(1) which C++ document are you referring to?
【在 a***r 的大作中提到】 : : My implementation is based on BinaryHeap,insert's worst-case cost is O(logN) : Fibonacci Heap's insert amortized cost is O(1) : which C++ document are you referring to?
a*r
22 楼
Complexity Constant (in the priority_queue). Although notice that push_heap operates in logarithmic time. I think it means the time spent inside priority_queue is O(1),if adding in push_heap, the overall complexity should be O(lgN).
【在 a***r 的大作中提到】 : : Complexity : Constant (in the priority_queue). Although notice that push_heap operates : in logarithmic time. : I think it means the time spent inside priority_queue is O(1),if adding in : push_heap, the overall complexity should be O(lgN).
不好意思,问的太笼统了 我不能理解的是如果用less 而且" returns true if a is to be placed earlier than b", 那么不应该是越小排在越前面,这样不就是min heap了? 为什么是max heap? 求指教
d*x
28 楼
人家就不能用less找出最大的嘛!
earlier
【在 b*******n 的大作中提到】 : 不好意思,问的太笼统了 : 我不能理解的是如果用less 而且" returns true if a is to be placed earlier : than b", 那么不应该是越小排在越前面,这样不就是min heap了? 为什么是max heap? : 求指教