Implementation of a min heap allowing for a comparator to be provided so that the heap may contain objects that involve a more complex comparison. This constructor constructs a MinHeap instance and takes two optional parameters: an array and comparator. If the array is provided, it will be used as the backing store for the heap. Therefore, all operations on the heap will be reflected in the provided array. Usage
A few examples of usage using the various constructor elements.
This example show basic usage using default parameters. The heap will create an internal array and use that as the backing store. The items in the heap will be compared using natural order.
This example shows usage of a custom comparator used to order the tiems based on internal properties.