2.4.11

question:

Suppose that your application will have a huge number of insert operations, but only a few remove the maximum operations. Which priority-queue implementation do you think would be most effective: heap, unordered array, or ordered array?

answer:
肯定是无序数组啊,虽然删除的时间复杂度是N,但是插入的时间复杂度是常数级别的;

//官网答案

Answer. Unordered array. Insert is constant time.

猜你喜欢

转载自www.cnblogs.com/w-j-c/p/9139681.html
今日推荐