Class BinaryHeap

  • All Implemented Interfaces:
    Heap

    public class BinaryHeap
    extends java.lang.Object
    implements Heap
    • Constructor Summary

      Constructors 
      Constructor Description
      BinaryHeap()
      A min heap for Node objects (sorted by heuristic).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Node extractMin()
      Removes and returns the min node.
      void insert​(Node node)
      Inserts a node into the heap.
      boolean isEmpty()
      Checks if the heap is empty of not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BinaryHeap

        public BinaryHeap()
        A min heap for Node objects (sorted by heuristic).
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Heap
        Checks if the heap is empty of not.
        Specified by:
        isEmpty in interface Heap
        Returns:
        true if the heap is empty and false if it is not
      • insert

        public void insert​(Node node)
        Description copied from interface: Heap
        Inserts a node into the heap.
        Specified by:
        insert in interface Heap
        Parameters:
        node - node to be inserted
      • extractMin

        public Node extractMin()
        Description copied from interface: Heap
        Removes and returns the min node.
        Specified by:
        extractMin in interface Heap
        Returns:
        the min node