MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / swap

Method swap

sort/heapsort.go:74–78  ·  view source on GitHub ↗
(i, j int)

Source from the content-addressed store, hash-verified

72}
73
74func (h *MaxHeap) swap(i, j int) {
75 h.slice[i], h.slice[j] = h.slice[j], h.slice[i]
76 h.updateidx(i)
77 h.updateidx(j)
78}
79
80func (h MaxHeap) more(i, j int) bool {
81 return h.slice[i].More(h.slice[j])

Callers 1

heapifyUpMethod · 0.95

Calls 1

updateidxMethod · 0.95

Tested by

no test coverage detected