Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. package bearmaps;
  2. /**
  3. * Priority queue where objects have a priority that is provided
  4. * extrinsically, i.e. are are supplied as an argument during insertion
  5. * and can be changed using the changePriority method.
  6. */
  7. public interface ExtrinsicMinPQ<T> {
  8. /* Adds an item with the given priority value. Throws an
  9. * IllegalArgumentExceptionb if item is already present.
  10. * You may assume that item is never null. */
  11. void add(T item, double priority);
  12. /* Returns true if the PQ contains the given item. */
  13. boolean contains(T item);
  14. /* Returns the minimum item. Throws NoSuchElementException if the PQ is empty. */
  15. T getSmallest();
  16. /* Removes and returns the minimum item. Throws NoSuchElementException if the PQ is empty. */
  17. T removeSmallest();
  18. /* Returns the number of items in the PQ. */
  19. int size();
  20. /* Changes the priority of the given item. Throws NoSuchElementException if the item
  21. * doesn't exist. */
  22. void changePriority(T item, double priority);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement