Documentation ¶
Index ¶
- type Item
- type PriorityQueue
- func (pq *PriorityQueue) Len() int
- func (pq *PriorityQueue) Less(i, j int) bool
- func (pq *PriorityQueue) Pop() interface{}
- func (pq *PriorityQueue) PopItem() interface{}
- func (pq *PriorityQueue) Push(x interface{})
- func (pq *PriorityQueue) PushItem(value interface{}, priority int)
- func (pq *PriorityQueue) Swap(i, j int)
- func (pq *PriorityQueue) Update(item *Item, value interface{}, priority int)
- type Queue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
func NewPriorityQueue ¶
func NewPriorityQueue() *PriorityQueue
NewPriorityQueue 初始化 PriorityQueue 实例
func (*PriorityQueue) PopItem ¶
func (pq *PriorityQueue) PopItem() interface{}
PopItem 从 PriorityQueue 中取出元素
func (*PriorityQueue) PushItem ¶
func (pq *PriorityQueue) PushItem(value interface{}, priority int)
PushItem 向 PriorityQueue 实例中添加元素
func (*PriorityQueue) Update ¶
func (pq *PriorityQueue) Update(item *Item, value interface{}, priority int)
Update 更新堆中元素的优先级
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
func GetDefaultQueue ¶
Click to show internal directories.
Click to hide internal directories.