Documentation ¶
Index ¶
- type Element
- type ElementList
- type PriorityQueue
- func (pq *PriorityQueue) ElementList() *ElementList
- func (pq *PriorityQueue) IsEmpty() bool
- func (pq *PriorityQueue) NumElements() int
- func (pq *PriorityQueue) Peek() Element
- func (pq *PriorityQueue) Pop() Element
- func (pq *PriorityQueue) Push(elem Element)
- func (pq *PriorityQueue) Remove(index int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ElementList ¶
type ElementList []Element
ElementList implements heap.Interface and holds Items.
func (*ElementList) IsEmpty ¶
func (el *ElementList) IsEmpty() bool
func (ElementList) Len ¶
func (el ElementList) Len() int
func (ElementList) Less ¶
func (el ElementList) Less(i, j int) bool
func (*ElementList) Peek ¶
func (el *ElementList) Peek() interface{}
func (*ElementList) Pop ¶
func (el *ElementList) Pop() interface{}
func (*ElementList) Push ¶
func (el *ElementList) Push(x interface{})
func (ElementList) Swap ¶
func (el ElementList) Swap(i, j int)
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue models a priority queue (max queue). The Pop() method returns the element with the MAX priority value
func CreatePriorityQueue ¶
func CreatePriorityQueue() *PriorityQueue
func (*PriorityQueue) ElementList ¶
func (pq *PriorityQueue) ElementList() *ElementList
func (*PriorityQueue) IsEmpty ¶
func (pq *PriorityQueue) IsEmpty() bool
func (*PriorityQueue) NumElements ¶
func (pq *PriorityQueue) NumElements() int
func (*PriorityQueue) Peek ¶
func (pq *PriorityQueue) Peek() Element
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() Element
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(elem Element)
func (*PriorityQueue) Remove ¶
func (pq *PriorityQueue) Remove(index int) error
Click to show internal directories.
Click to hide internal directories.