Documentation ¶
Index ¶
- type Item
- type PriorityQueue
- func (pq *PriorityQueue[T]) GetIndex(x interface{}) int
- func (pq PriorityQueue[T]) Len() int
- func (pq PriorityQueue[T]) Less(i, j int) bool
- func (pq *PriorityQueue[T]) Pop() interface{}
- func (pq *PriorityQueue[T]) Push(x interface{})
- func (pq PriorityQueue[T]) Swap(i, j int)
- func (pq *PriorityQueue[T]) Top() interface{}
- func (pq *PriorityQueue[T]) Update(item *Item[T], priority int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
PriorityQueue provides a heap.Interface compatible priority queue for the Item type. The actual Item.index in the queue is controlled by the Item.Priority and Item.timeStamp.
func (*PriorityQueue[T]) GetIndex ¶
func (pq *PriorityQueue[T]) GetIndex(x interface{}) int
GetIndex returns the index of the corresponding element.
func (PriorityQueue[T]) Len ¶
func (pq PriorityQueue[T]) Len() int
Len: Size of the priority queue . Used to satisfy the heap interface...
func (PriorityQueue[T]) Less ¶
func (pq PriorityQueue[T]) Less(i, j int) bool
Less is used to compare elements and store them in the proper order in priority queue.
func (*PriorityQueue[T]) Pop ¶
func (pq *PriorityQueue[T]) Pop() interface{}
Pop removes elements from the priority queue
func (*PriorityQueue[T]) Push ¶
func (pq *PriorityQueue[T]) Push(x interface{})
Push adds elements to the priority queue
func (PriorityQueue[T]) Swap ¶
func (pq PriorityQueue[T]) Swap(i, j int)
Swap is used to swap the values in the priority queue.
func (*PriorityQueue[T]) Top ¶
func (pq *PriorityQueue[T]) Top() interface{}
Top returns the topmost element in the priority queue
func (*PriorityQueue[T]) Update ¶
func (pq *PriorityQueue[T]) Update(item *Item[T], priority int)
Update updates the attributes of an element in the priority queue.