goalgr

module
v0.0.0-...-f63f6ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2021 License: MIT

README

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 )
    }

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL