Push and Pop use pointer receivers because they modify the slice's length, not just its contents. Push add a value to the tail of the priority queue
(x interface{})
| 31 | |
| 32 | // Push add a value to the tail of the priority queue |
| 33 | func (pq *PQueue) Push(x interface{}) { |
| 34 | *pq = append(*pq, x.(PQueueNode)) |
| 35 | } |
| 36 | |
| 37 | // Pop removes a value from the head of the priority queue |
| 38 | func (pq *PQueue) Pop() interface{} { |
no outgoing calls