Fix PriorityQueue javadoc.
This commit is contained in:
parent
9b01a61da2
commit
a269d66470
1 changed files with 28 additions and 1 deletions
|
@ -3,18 +3,29 @@ package org.insa.algo.utils;
|
|||
/**
|
||||
* Interface representing a basic priority queue.
|
||||
*
|
||||
* @see https://en.wikipedia.org/wiki/Priority_queue
|
||||
* Implementation should enforce the required complexity of each method.
|
||||
*
|
||||
*/
|
||||
public interface PriorityQueue<E extends Comparable<E>> {
|
||||
|
||||
/**
|
||||
* Check if the priority queue is empty.
|
||||
*
|
||||
* <p>
|
||||
* <b>Complexity:</b> <i>O(1)</i>
|
||||
* </p>
|
||||
*
|
||||
* @return true if the queue is empty, false otherwise.
|
||||
*/
|
||||
public boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Get the number of elements in this queue.
|
||||
*
|
||||
* <p>
|
||||
* <b>Complexity:</b> <i>O(1)</i>
|
||||
* </p>
|
||||
*
|
||||
* @return Current size (number of elements) of this queue.
|
||||
*/
|
||||
public int size();
|
||||
|
@ -22,6 +33,10 @@ public interface PriorityQueue<E extends Comparable<E>> {
|
|||
/**
|
||||
* Insert the given element into the queue.
|
||||
*
|
||||
* <p>
|
||||
* <b>Complexity:</b> <i>O(log n)</i>
|
||||
* </p>
|
||||
*
|
||||
* @param x Item to insert.
|
||||
*/
|
||||
public void insert(E x);
|
||||
|
@ -29,6 +44,10 @@ public interface PriorityQueue<E extends Comparable<E>> {
|
|||
/**
|
||||
* Remove the given element from the priority queue.
|
||||
*
|
||||
* <p>
|
||||
* <b>Complexity:</b> <i>O(log n)</i>
|
||||
* </p>
|
||||
*
|
||||
* @param x Item to remove.
|
||||
*/
|
||||
public void remove(E x) throws ElementNotFoundException;
|
||||
|
@ -36,6 +55,10 @@ public interface PriorityQueue<E extends Comparable<E>> {
|
|||
/**
|
||||
* Retrieve (but not remove) the smallest item in the queue.
|
||||
*
|
||||
* <p>
|
||||
* <b>Complexity:</b> <i>O(1)</i>
|
||||
* </p>
|
||||
*
|
||||
* @return The smallest item in the queue.
|
||||
*
|
||||
* @throws EmptyPriorityQueueException if this queue is empty.
|
||||
|
@ -45,6 +68,10 @@ public interface PriorityQueue<E extends Comparable<E>> {
|
|||
/**
|
||||
* Remove and return the smallest item from the priority queue.
|
||||
*
|
||||
* <p>
|
||||
* <b>Complexity:</b> <i>O(log n)</i>
|
||||
* </p>
|
||||
*
|
||||
* @return The smallest item in the queue.
|
||||
*
|
||||
* @throws EmptyPriorityQueueException if this queue is empty.
|
||||
|
|
Loading…
Reference in a new issue