diff options
Diffstat (limited to 'libgo/go/container/heap/heap.go')
-rw-r--r-- | libgo/go/container/heap/heap.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libgo/go/container/heap/heap.go b/libgo/go/container/heap/heap.go index bbaf40a..c37e50e 100644 --- a/libgo/go/container/heap/heap.go +++ b/libgo/go/container/heap/heap.go @@ -4,13 +4,13 @@ // Package heap provides heap operations for any type that implements // heap.Interface. A heap is a tree with the property that each node is the -// highest-valued node in its subtree. +// minimum-valued node in its subtree. // // A heap is a common way to implement a priority queue. To build a priority // queue, implement the Heap interface with the (negative) priority as the // ordering for the Less method, so Push adds items while Pop removes the // highest-priority item from the queue. The Examples include such an -// implementation; the file example_test.go has the complete source. +// implementation; the file example_pq_test.go has the complete source. // package heap @@ -90,7 +90,7 @@ func up(h Interface, j int) { func down(h Interface, i, n int) { for { j1 := 2*i + 1 - if j1 >= n { + if j1 >= n || j1 < 0 { // j1 < 0 after int overflow break } j := j1 // left child |