Skip to content

dannoane/priority-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

priority-queue

priority queue implementation in golang

PkgGoDev Build Status Coverage Status

Description

A generic priority queue implementation over a max heap.

Usage

package main

import (
    "fmt"
    "github.com/dannoane/priority-queue"
)

func main() {
    pq := priorityqueue.NewPriorityQueue()
    pq.Push(&priorityqueue.Element{Value: 1, Priority: 200})
    pq.Push(&priorityqueue.Element{Value: 2, Priority: 100})
    pq.Push(&priorityqueue.Element{Value: 3, Priority: 300})

    for !pq.IsEmpty() {
        fmt.Println(pq.Pop().Value)
    }
}

About

generic priority queue implementation in golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages