Class MapBinaryHeap<T>

java.lang.Object
java.util.AbstractCollection<T>
edu.uci.ics.jung.algorithms.util.MapBinaryHeap<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, Queue<T>

public class MapBinaryHeap<T> extends AbstractCollection<T> implements Queue<T>
An array-based binary heap implementation of a priority queue, which also provides efficient update() and contains operations. It contains extra infrastructure (a hash table) to keep track of the position of each element in the array; thus, if the key value of an element changes, it may be "resubmitted" to the heap via update so that the heap can reposition it efficiently, as necessary.
Author:
Joshua O'Madadhain
  • Constructor Details

    • MapBinaryHeap

      public MapBinaryHeap(Comparator<T> comp)
      Creates a MapBinaryHeap whose heap ordering is based on the ordering of the elements specified by comp.
      Parameters:
      comp - the comparator to use to order elements in the heap
    • MapBinaryHeap

      public MapBinaryHeap()
      Creates a MapBinaryHeap whose heap ordering will be based on the natural ordering of the elements, which must be Comparable.
    • MapBinaryHeap

      public MapBinaryHeap(Collection<T> c)
      Creates a MapBinaryHeap based on the specified collection whose heap ordering will be based on the natural ordering of the elements, which must be Comparable.
      Parameters:
      c - the collection of Comparable elements to add to the heap
    • MapBinaryHeap

      public MapBinaryHeap(Collection<T> c, Comparator<T> comp)
      Creates a MapBinaryHeap based on the specified collection whose heap ordering is based on the ordering of the elements specified by c.
      Parameters:
      c - the collection of elements to add to the heap
      comp - the comparator to use for items in c
  • Method Details