Package arc.struct

Class BinaryHeap<T extends BinaryHeap.Node>

java.lang.Object
arc.struct.BinaryHeap<T>

public class BinaryHeap<T extends BinaryHeap.Node> extends Object
  • Field Details

    • size

      public int size
  • Constructor Details

    • BinaryHeap

      public BinaryHeap()
    • BinaryHeap

      public BinaryHeap(int capacity, boolean isMaxHeap)
  • Method Details

    • add

      public T add(T node)
    • add

      public T add(T node, float value)
    • contains

      public boolean contains(T node, boolean identity)
      Returns if binary heap contains the provided node.
      Parameters:
      node - May be null.
      identity - If true, == comparison will be used. If false, .equals() comparison will be used.
    • peek

      public T peek()
    • pop

      public T pop()
    • remove

      public T remove(T node)
    • isEmpty

      public boolean isEmpty()
      Returns true if the heap is empty.
    • clear

      public void clear()
    • setValue

      public void setValue(T node, float value)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object