func (h *BHeap) down(u int) {
	for {
		v1, v2 := h.childs(u)
		if v1 >= h.next {
			return
		}
		if v1 != v2 && v2 < h.next && h.comp(h.get(v2), h.get(v1)) {
			v1 = v2
		}
		if h.comp(h.get(u), h.get(v1)) {
			return
		}
		h.swap(u, v1)
		u = v1
	}
}
Values returns values presented in heap
func (h *BHeap) Values() []interface{} {
return h.data[:h.next]
}
package heap
type BHeap struct {
	data   []interface{}
	comp   func(interface{}, interface{}) bool
	size   int
	mask   int
	shift  int
	rows   int
	length int
	next   int
}
const rowShift int = 16
const rowWidth int = 1 << uint(rowShift)
func NewBHeapSized(size int, comp func(interface{}, interface{}) bool) *BHeap {
	u := 1
	for ; (1 << uint(u)) != size; u++ {
	}
	r := 16
	h := &BHeap{
		data:   make([]interface{}, r),
		comp:   comp,
		size:   size,
		mask:   size - 1,
		shift:  u,
		rows:   r,
		length: 0,
		next:   1,
	}
	h.addRow()
	h.set(1, nil)
	return h
}
func (h *BHeap) Size() int {
	return h.next - 1
}
func (h *BHeap) IsEmpty() bool {
	return h.next == 1
}
func (h *BHeap) Push(value interface{}) {
	if h.length == h.next {
		h.addRow()
	}
	u := h.next
	h.next++
	h.set(u, value)
	h.up(u)
}
func (h *BHeap) Pop() (value interface{}, ok bool) {
	if h.IsEmpty() {
		return nil, false
	}
	value = h.get(1)
	h.swap(1, h.next-1)
	h.next--
	h.down(1)
	return value, true
}
func (h *BHeap) Top() (value interface{}, ok bool) {
	if h.IsEmpty() {
		return nil, false
	}
	return h.get(1), true
}