Skip to content

Instantly share code, notes, and snippets.

@bgadrian
Created September 6, 2017 23:50
Show Gist options
  • Save bgadrian/963a4fab25bef812bb659af77b5883e4 to your computer and use it in GitHub Desktop.
Save bgadrian/963a4fab25bef812bb659af77b5883e4 to your computer and use it in GitHub Desktop.
Go example for my hierarchical queue structure
package main
import (
"fmt"
"github.com/BTooLs/data-structures/priorityqueue"
)
func main() {
autoLockMutex := false
var lowestPriority uint8 = 10 //highest is 0
l := priorityqueue.NewHierarchicalQueue(lowestPriority, autoLockMutex)
l.Enqueue("a", 8)
l.Enqueue("b", 1)
first, _ := l.Dequeue()
fmt.Printf("first is %v", first)
// Output: first is b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment