-
Notifications
You must be signed in to change notification settings - Fork 6
Simple priority queue in Go
License
nu7hatch/gopqueue
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Priority Queue in Go ==================== This package provides a priority queue implementation and scaffold interfaces. Installation ------------ Use the `goinstall` tool: $ goinstall github.com/nu7hatch/gopqueue ... or install it manually: $ git clone git://github.com/nu7hatch/gopqueue.git $ cd gopqueue $ make install Usage ----- Here's trivial example of the fast queue usage: package main import pqueue "github.com/nu7hatch/gopqueue" type Task struct { Name string priority int } func (t *Task) Less(other interface{}) bool { return t.priority < other.(*Task).priority } func main() { q := pqueue.New(0) q.Enqueue(&Task{"one", 10}) q.Enqueue(&Task{"two", 2}) q.Enqueue(&Task{"three", 5}) q.Enqueue(&Task{"four", 7}) for i := 0; i < 4; i += 1 { task := q.Dequeue() println(task.(*Task).Name) } } // Produces: // // two // three // four // one For more information and examples check the package documentation. Copyright --------- Copyright (C) 2011 by Krzysztof Kowalik <chris@nu7hat.ch> See COPYING file for details.
About
Simple priority queue in Go
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published