Methods in an ADT:

  • insert(k,x): inserts an entry with key and value into a priority key .
  • removeMin(): removes the entry with smallest key from .
  • min(): returns but does not remove an entry of with smallest key.
  • size(): returns the number of entries in priority queue .
  • isEmpty(): tests whether priority queue is empty.

Entry ADT

An entry in a priority key is simply a key-value pair. There may be two methods: getKey(), getValue().

Comparator ADT

A comparator encapsulates the action of comparing two objects according to a given Total Order Relation.

The primary method of the comparator is:

  • compare(x,y): returns an integer such that:
    • if
    • if
    • if