Documentation ¶
Index ¶
- Variables
- type PriorityQueue
- func (p *PriorityQueue) Insert(v interface{}, priority int64) error
- func (p *PriorityQueue) Len() int
- func (p *PriorityQueue) Pop() (interface{}, error)
- func (p *PriorityQueue) Remove(x interface{})
- func (p *PriorityQueue) Top() (interface{}, error)
- func (p *PriorityQueue) UpdatePriority(x interface{}, newPriority int64) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue represents the queue
func (*PriorityQueue) Insert ¶
func (p *PriorityQueue) Insert(v interface{}, priority int64) error
Insert inserts a new element into the queue. No action is performed on duplicate elements.
func (*PriorityQueue) Len ¶
func (p *PriorityQueue) Len() int
Len returns the number of elements in the queue.
func (*PriorityQueue) Pop ¶
func (p *PriorityQueue) Pop() (interface{}, error)
Pop removes the element with the highest priority from the queue and returns it. In case of an empty queue, an error is returned.
func (*PriorityQueue) Top ¶
func (p *PriorityQueue) Top() (interface{}, error)
Top returns the element with the highest priority from the queue.
func (*PriorityQueue) UpdatePriority ¶
func (p *PriorityQueue) UpdatePriority(x interface{}, newPriority int64) error
UpdatePriority changes the priority of a given item. If the specified item is not present in the queue, no action is performed.
Click to show internal directories.
Click to hide internal directories.