func (h *heap) Remove() heapNode {
	if len(h.nodes) == 0 {
		return nil
	}
	rootNode := h.nodes[0]
	h.nodes[0] = h.nodes[len(h.nodes)-1]
	h.nodes = h.nodes[:len(h.nodes)-1]
	h.heapifyFromStart()
	return rootNode
}
Remove returns the node at the root, i.e. the minimum value node
package heap
type MinHeap struct {
	heap
}
func NewMinHeap() *MinHeap {
	nestedHeap := heap{
		closerToRoot: func(val1, val2 int) bool {
			return val1 < val2
		},
	}
	return &MinHeap{nestedHeap}
}
type MaxHeap struct {
	heap
}
func NewMaxHeap() *MaxHeap {
	nestedHeap := heap{
		closerToRoot: func(val1, val2 int) bool {
			return val1 > val2
		},
	}
	return &MaxHeap{nestedHeap}
}
type heap struct {
	nodes        []heapNode
	closerToRoot func(val1, val2 int) bool
}
type heapNode interface {
	Value() int
}
func (h *heap) Front() heapNode {
	if len(h.nodes) == 0 {
		return nil
	}
	return h.nodes[0]
}
func (h *heap) Add(newNode heapNode) {
	h.nodes = append(h.nodes, newNode)
	h.heapifyFromEnd()
}