I would need 2 object : max heap and min heap. Both objects will be the same but some their methods like swap or bubbleUp compare object in different way. Only comparing lines are different:
while (curr > 0 && (heap[parent].compareTo(heap[curr]) < 0)) {
Is it better to create Heap class that has got boolean value that stores information is it max or min heap? Or is better to create subclasses for min and max heap that will have got their own methods?
public abstract class Heap {
private int[] values = new int[];
public void SomeHeapMethod()
{
if(values[0].compareTo(values[1]) > 0 ) //this would be diffent for max and min heap
}
}