File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ package heap
18
18
19
19
import "sort"
20
20
21
- // Any type that implements heap.Interface may be used as a
21
+ // The Interface type describes the requirements
22
+ // for a type using the routines in this package.
23
+ // Any type that implements it may be used as a
22
24
// min-heap with the following invariants (established after
23
25
// Init has been called or if the data is empty or sorted):
24
26
//
@@ -33,11 +35,10 @@ type Interface interface {
33
35
Pop () interface {} // remove and return element Len() - 1.
34
36
}
35
37
36
- // A heap must be initialized before any of the heap operations
37
- // can be used. Init is idempotent with respect to the heap invariants
38
+ // Init establishes the heap invariants required by the other routines in this package.
39
+ // Init is idempotent with respect to the heap invariants
38
40
// and may be called whenever the heap invariants may have been invalidated.
39
41
// Its complexity is O(n) where n = h.Len().
40
- //
41
42
func Init (h Interface ) {
42
43
// heapify
43
44
n := h .Len ()
You can’t perform that action at this time.
0 commit comments