Documentation ¶
Index ¶
- type Comparabler
- type Float
- type InnerType
- type Integer
- type Interface
- type PriorityQueue
- func (pq *PriorityQueue) Empty() bool
- func (pq *PriorityQueue) Len() int
- func (pq *PriorityQueue) Less(i, j int) bool
- func (pq *PriorityQueue) Pop() interface{}
- func (pq *PriorityQueue) Popx() (x Comparabler)
- func (pq *PriorityQueue) Push(x interface{})
- func (pq *PriorityQueue) Pushx(x Comparabler)
- func (pq *PriorityQueue) Swap(i, j int)
- func (pq *PriorityQueue) Topx() (x Comparabler)
- type Signed
- type String
- type Unsigned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comparabler ¶
type Comparabler interface { Interface }
Comparabler types that can be compared, with base types(todo)
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue priority queue based container/heap
func InitPq ¶
func InitPq(comps ...Comparabler) (pq *PriorityQueue)
InitPq initial a priority queue instance
func (*PriorityQueue) Less ¶
func (pq *PriorityQueue) Less(i, j int) bool
Less implement heap interface
func (*PriorityQueue) Popx ¶
func (pq *PriorityQueue) Popx() (x Comparabler)
Popx pop a element from priority queue, removes and returns the top element
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
Push implement heap interface
func (*PriorityQueue) Pushx ¶
func (pq *PriorityQueue) Pushx(x Comparabler)
Pushx push a element into priority queue
func (*PriorityQueue) Topx ¶
func (pq *PriorityQueue) Topx() (x Comparabler)
Top returns the top element but don't remove
Click to show internal directories.
Click to hide internal directories.