2.4.18

question:

In MaxPQ, suppose that a client calls insert() with an item that is larger than all items in the queue, and then immediately call delMax(). Assume that there are no dumplicate keys. Is the resulting heap idential to the heap as it was before these operations? Answer the same question for two insert() operations (the first with a key larger than all keys in the queue and the second for a key larger than that one) followed by two delMax() operations.

answer:

//因为假设没有重复的元素,所以第一问和第二问一样都是和原来的堆元素位置一模一样的

猜你喜欢

转载自www.cnblogs.com/w-j-c/p/9141290.html