Interface AdjustableHeap<T>

Type Parameters:
T - The type of elements stored in the heap.
All Known Implementing Classes:
AdjustableBinaryHeap

public interface AdjustableHeap<T>
An interface representing an adjustable binary heap data structure.

An adjustable heap is a binary heap that allows for efficient adjustments of element priorities.

This interface provides methods to increase or decrease the priority of existing elements in the heap while maintaining the heap property defined by the comparator.

Depending on the implementation the adjustable heap maintains a partial ordering, also known as a "weak ordering," among its elements. Unlike traditional binary heaps, this heap does not require a total order relation among elements. As a result, the element's relative priority may not be strictly determined with respect to other elements.

The adjustable heap implementation is not thread-safe, and it does not allow duplicate elements. The provided comparator should be consistent with equals() and hashcode() to ensure correct behavior.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    decreaseKey(T item, T decreasedItem)
    Try to decrease item if it's present in this heap.
    boolean
    increaseKey(T item, T increasedItem)
    Try to increase item if it's present in this heap.
  • Method Details

    • increaseKey

      boolean increaseKey(T item, T increasedItem)
      Try to increase item if it's present in this heap.
      Parameters:
      item - to be increased
      increasedItem - increasing item
      Returns:
      true if item is present and successfully increased
    • decreaseKey

      boolean decreaseKey(T item, T decreasedItem)
      Try to decrease item if it's present in this heap.
      Parameters:
      item - to be decreased
      decreasedItem - decreasing item
      Returns:
      true if item is present and successfully decreased