Interface MaxHeapInterface<T extends Comparable<? super T>>

All Known Implementing Classes:
MaxHeap

public interface MaxHeapInterface<T extends Comparable<? super T>>
An interface for the ADT maxheap.
Version:
1.0
Author:
Lindsay Kilingbury, Lea Wiranatha
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T newEntry)
    Adds a new entry to this heap.
    void
    Removes all entries from this heap.
    Retrieves the largest item in this heap.
    int
    Gets the size of this heap.
    boolean
    Detects whether this heap is empty.
    Removes and returns the largest item in this heap.
  • Method Details

    • add

      void add(T newEntry)
      Adds a new entry to this heap.
      Parameters:
      newEntry - An object to be added.
    • removeMax

      T removeMax()
      Removes and returns the largest item in this heap.
      Returns:
      Either the largest object in the heap or, if the heap is empty before the operation, null.
    • getMax

      T getMax()
      Retrieves the largest item in this heap.
      Returns:
      Either the largest object in the heap or, if the heap is empty, null.
    • isEmpty

      boolean isEmpty()
      Detects whether this heap is empty.
      Returns:
      True if the heap is empty, or false otherwise.
    • getSize

      int getSize()
      Gets the size of this heap.
      Returns:
      The number of entries currently in the heap.
    • clear

      void clear()
      Removes all entries from this heap.