2019-03-12 02:54:52 +00:00
|
|
|
package pqueue
|
|
|
|
|
2019-03-24 17:40:12 +00:00
|
|
|
import (
|
|
|
|
"474420502.top/eson/structure/compare"
|
|
|
|
)
|
2019-03-16 17:41:07 +00:00
|
|
|
|
2019-03-12 02:54:52 +00:00
|
|
|
type PriorityQueue struct {
|
2019-03-24 17:40:12 +00:00
|
|
|
queue *vbTree
|
|
|
|
head *tNode
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Iterator() *Iterator {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func New(Compare compare.Compare) *PriorityQueue {
|
|
|
|
return &PriorityQueue{queue: newVBT(Compare)}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Size() int {
|
|
|
|
return pq.queue.Size()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Push(value interface{}) {
|
2019-04-06 20:32:43 +00:00
|
|
|
|
2019-03-24 17:40:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Top() (result interface{}, ok bool) {
|
|
|
|
if pq.head != nil {
|
|
|
|
return pq.head.value, true
|
|
|
|
}
|
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Pop() (result interface{}, ok bool) {
|
2019-04-06 20:32:43 +00:00
|
|
|
|
2019-03-24 17:40:12 +00:00
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Get(idx int) (interface{}, bool) {
|
|
|
|
return nil, false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) RemoveWithIndex(idx int) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Remove(key interface{}) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pq *PriorityQueue) Values() []interface{} {
|
|
|
|
return nil
|
2019-03-12 02:54:52 +00:00
|
|
|
}
|