Package algs24

Class XFixedMaxPQ<K extends Comparable<? super K>>

java.lang.Object
algs24.XFixedMaxPQ<K>
All Implemented Interfaces:
Iterable<K>

public class XFixedMaxPQ<K extends Comparable<? super K>> extends Object implements Iterable<K>
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    XFixedMaxPQ(int initCapacity)
     
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    Delete and return the largest key on the priority queue.
    void
    insert(K x)
    Add a new key to the priority queue.
    boolean
    Is the priority queue empty?
    boolean
    Is the priority queue full?
    Return an iterator that iterates over all of the keys on the priority queue in descending order.
    static void
    main(String[] args)
    A test client.
    max()
    Return the largest key on the priority queue.
    int
    Return the number of items on the priority queue.

    Methods inherited from class java.lang.Object Link icon

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable Link icon

    forEach, spliterator
  • Constructor Details Link icon

  • Method Details Link icon

    • isEmpty Link icon

      public boolean isEmpty()
      Is the priority queue empty?
    • isFull Link icon

      public boolean isFull()
      Is the priority queue full?
    • size Link icon

      public int size()
      Return the number of items on the priority queue.
    • max Link icon

      public K max()
      Return the largest key on the priority queue. Throw an exception if the priority queue is empty.
    • insert Link icon

      public void insert(K x)
      Add a new key to the priority queue.
    • delMax Link icon

      public K delMax()
      Delete and return the largest key on the priority queue. Throw an exception if the priority queue is empty.
    • iterator Link icon

      public Iterator<K> iterator()
      Return an iterator that iterates over all of the keys on the priority queue in descending order.

      The iterator doesn't implement remove() since it's optional.

      Specified by:
      iterator in interface Iterable<K extends Comparable<? super K>>
    • main Link icon

      public static void main(String[] args)
      A test client.