Page 229, Exercise 2

ADT MinPriorityQueue is
objects: a collection of n > 0 elements, each element has a key
functions:
for all q ∈ MinPriorityQueue, item ∈ Element, n ∈ integer

MinPriorityQueue create(max_size) ::= creates an empty priority queue
Boolean isEmpty(q,n) ::= if(n>0) return TRUE
     return FALSE
Element top(q, n) ::= if (!isEmpty(q,n) return an instance of the smallest element in q
    return ERROR
Element pop (q, n)

::= if (!isEmpty(q,n) return an instance of the smallest element in q and
remove it from the priority queue.
    return ERROR

MinPriorityQueue push(q, item, n) ::= insert item into q and return the resulting priority queue.

end MinPriorityQueue