Interface MergeablePriorityQueue<E,T extends MergeablePriorityQueue<E,T>>

Type Parameters:
E - The type of object contained in the PriorityQueue.
T - The type of MergeablePriorityQueue supported by the merge
All Superinterfaces:
Collection<PriorityQueueNode.Integer<E>>, Iterable<PriorityQueueNode.Integer<E>>, PriorityQueue<E>, Queue<PriorityQueueNode.Integer<E>>
All Known Implementing Classes:
BinaryHeap, FibonacciHeap, SimpleBinaryHeap, SimpleFibonacciHeap

public interface MergeablePriorityQueue<E,T extends MergeablePriorityQueue<E,T>> extends PriorityQueue<E>
A MergeablePriorityQueue is a PriorityQueue that includes a merge method.
  • Method Details

    • merge

      boolean merge(T other)
      Merges another priority queue into this one, adding all of its (element, priority) pairs. This is a destructive operation with no guarantees to the state of the other priority queue upon completion. Additionally, some implementations of this method may assume that other and this do not share any elements, and the priority queue may become unstable if they do. The priority order of both priority queues must be the same (e.g., both minheaps or both maxheaps).
      Parameters:
      other - The priority queue that you want to merge into this. Implementations need not make any guarantees as to the state of other upon completion.
      Returns:
      true if and only if this priority queue changed as a result of the merge