summaryrefslogtreecommitdiff
path: root/src/pkg/container/heap/example_intheap_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/container/heap/example_intheap_test.go')
-rw-r--r--src/pkg/container/heap/example_intheap_test.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pkg/container/heap/example_intheap_test.go b/src/pkg/container/heap/example_intheap_test.go
index e718cbc58..02d3d8668 100644
--- a/src/pkg/container/heap/example_intheap_test.go
+++ b/src/pkg/container/heap/example_intheap_test.go
@@ -31,13 +31,17 @@ func (h *IntHeap) Pop() interface{} {
return x
}
-// This example inserts several ints into an IntHeap and removes them in order of priority.
+// This example inserts several ints into an IntHeap, checks the minimum,
+// and removes them in order of priority.
func Example_intHeap() {
h := &IntHeap{2, 1, 5}
heap.Init(h)
heap.Push(h, 3)
+ fmt.Printf("minimum: %d\n", (*h)[0])
for h.Len() > 0 {
fmt.Printf("%d ", heap.Pop(h))
}
- // Output: 1 2 3 5
+ // Output:
+ // minimum: 1
+ // 1 2 3 5
}