func (pq internalQueue) Less(i, j int) bool {
	return pq[i].value.Less(pq[j].value)
}
Less reports whether the element with
index i should sort before the element with index j.
package pq
import (
	"container/heap"
)
type PriorityQueue struct {
	queue *internalQueue
}
func NewPriorityQueue() *PriorityQueue {
	pq := &internalQueue{}
	heap.Init(pq)
	return &PriorityQueue{
		queue: pq,
	}
}
func (pq *PriorityQueue) Peek() Value {
	return pq.queue.Peek().(*pqItem).value
}
func (pq *PriorityQueue) Pop() Value {
	return heap.Pop(pq.queue).(*pqItem).value
}
func (pq *PriorityQueue) Push(value Value) {
	item := newPQItem(value)
	heap.Push(pq.queue, item)
}
func (pq *PriorityQueue) Len() int {
	return pq.queue.Len()
}
func (pq *PriorityQueue) Release(value Value) {
	idx := -1
	for i, item := range *pq.queue {
		if item.value == value {
			idx = i
			break
		}
	}
	if idx == -1 {
		return
	}
	heap.Remove(pq.queue, idx)
}
func (pq *PriorityQueue) Values() []Value {
	var values []Value
	for _, item := range *pq.queue {
		values = append(values, item.value)
	}
	return values
}
type Value interface {
	Less(other Value) bool
}
type pqItem struct {
	value Value
	index int
}
func newPQItem(value Value) *pqItem {
	return &pqItem{
		value: value,
		index: -1,
	}
}
type internalQueue []*pqItem
func (pq internalQueue) Len() int { return len(pq) }