We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b66711f + 483718d commit dd8eb66Copy full SHA for dd8eb66
heap.go
@@ -174,9 +174,7 @@ func (x *Heap[T]) down(parentIndex, n int) bool {
174
175
// 交换两个下标位置的元素
176
func (x *Heap[T]) swap(i, j int) {
177
- t := x.heapSlice[i]
178
- x.heapSlice[i] = x.heapSlice[j]
179
- x.heapSlice[j] = t
+ x.heapSlice[i], x.heapSlice[j] = x.heapSlice[j], x.heapSlice[i]
180
}
181
182
// ------------------------------------------------ ---------------------------------------------------------------------
0 commit comments