Commit ee57e36d authored by wuyunzhou's avatar wuyunzhou Committed by Robert Griesemer

container/heap: avoid up() invoke if down() success at heap.Remove()

Change-Id: I6c210e0c23ca533e1f303f88ef9dcb629a294a2a
Reviewed-on: https://go-review.googlesource.com/43472Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
parent 1fcd7861
......@@ -72,8 +72,9 @@ func Remove(h Interface, i int) interface{} {
n := h.Len() - 1
if n != i {
h.Swap(i, n)
down(h, i, n)
up(h, i)
if !down(h, i, n) {
up(h, i)
}
}
return h.Pop()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment