Documentation
¶
Index ¶
Constants ¶
View Source
const ( Min heapType = 1 Max heapType = 2 )
Variables ¶
View Source
var ErrBinaryHeapIsEmpty = fmt.Errorf("binary heap is empty")
View Source
var ErrNotFound = fmt.Errorf("value with priority not found")
Functions ¶
This section is empty.
Types ¶
type BinaryHeap ¶
type BinaryHeap struct {
// contains filtered or unexported fields
}
func New ¶
func New(elements map[int]interface{}, heapType heapType) (*BinaryHeap, error)
@TODO: need to add support for multiple same-priority node insertion
func (*BinaryHeap) Insert ¶
func (s *BinaryHeap) Insert(priority int, value interface{}) error
func (*BinaryHeap) Peek ¶
func (h *BinaryHeap) Peek() (interface{}, error)
func (*BinaryHeap) Remove ¶
func (h *BinaryHeap) Remove(priority int) error
func (*BinaryHeap) Top ¶
func (h *BinaryHeap) Top() (interface{}, error)
Click to show internal directories.
Click to hide internal directories.