package
Version:
v0.0.0-...-406fbc5
Opens a new window with list of versions in this module.
Published: Mar 14, 2015
License: BSD-3-Clause
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
PQueue implements a heap-based priority queue
Len returns the number of elements in the queue
func (h *PQueue) Pop() interface{}
Pop returns the first element in the queue.
Make sure to check the queue size to ensure it has at least one item.
func (h *PQueue) Push(item interface{}, priority int)
Push inserts an element in the queue with the given priority
Queue implements a FIFO data structure, holding arbitrary data types
NewQueue creates an empty queue
Len returns the queue size
func (q *Queue) Peek() interface{}
Pop returns the front item in the queue, or nil if the queue is empty.
func (q *Queue) Pop() interface{}
Pop returns the front item in the queue, or nil if the queue is empty.
Unlike Peek(), the item is removed from the queue
func (q *Queue) Push(item interface{})
Push inserts a new item in the queue
Stack implements a LIFO data structure, holding arbitrary data types
NewStack creates an empty stack
Len returns the stack size
func (stack *Stack) Peek() interface{}
Pop returns the front item in the stack, or nil if the stack is empty.
func (stack *Stack) Pop() interface{}
Pop returns the front item in the stack, or nil if the stack is empty.
Unlike Peek(), the item is removed from the stack
func (stack *Stack) Push(item interface{})
Push inserts a new item in the stack
Source Files
¶
Click to show internal directories.
Click to hide internal directories.