Skip to content

Commit 5000000

Browse files
authored
Merge cff8a71 into 99fc317
2 parents 99fc317 + cff8a71 commit 5000000

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/container/heap/heap.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type Interface interface {
3838
// Init is idempotent with respect to the heap invariants
3939
// and may be called whenever the heap invariants may have been invalidated.
4040
// The complexity is O(n) where n = h.Len().
41-
func Init(h Interface) {
41+
func Init(h sort.Interface) {
4242
// heapify
4343
n := h.Len()
4444
for i := n/2 - 1; i >= 0; i-- {
@@ -80,13 +80,13 @@ func Remove(h Interface, i int) any {
8080
// Changing the value of the element at index i and then calling Fix is equivalent to,
8181
// but less expensive than, calling [Remove](h, i) followed by a Push of the new value.
8282
// The complexity is O(log n) where n = h.Len().
83-
func Fix(h Interface, i int) {
83+
func Fix(h sort.Interface, i int) {
8484
if !down(h, i, h.Len()) {
8585
up(h, i)
8686
}
8787
}
8888

89-
func up(h Interface, j int) {
89+
func up(h sort.Interface, j int) {
9090
for {
9191
i := (j - 1) / 2 // parent
9292
if i == j || !h.Less(j, i) {
@@ -97,7 +97,7 @@ func up(h Interface, j int) {
9797
}
9898
}
9999

100-
func down(h Interface, i0, n int) bool {
100+
func down(h sort.Interface, i0, n int) bool {
101101
i := i0
102102
for {
103103
j1 := 2*i + 1

0 commit comments

Comments
 (0)