Skip to content

ApixelInc/goalgr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

goalgr

PriorityQueue

imporrt "github.com/ApixelInc/goalgr/PQ"

    // create and init with existing items
    pq := PQ.New()

    items := []string{
        "banana", "apple", "pear",
    }
    for i, value := range items {
        priority := i
        pq.Push( value, priority )
    }

    item := pq.Push( "orange", 1 )

    // but we want change the priority...
    pq.Update(item.(*PQ.InternalItem), "orange2"  , 0)

    // Take the items out; they arrive in decreasing priority order.
    for !pq.IsEmpty() {
        fruit := pq.Pop()
        fmt.Printf("%+v ", fruit )
    }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages