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

Method Pop

sort/heapsort.go:37–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35}
36
37func (h *MaxHeap) Pop() Comparable {
38 if h.heapSize == 0 {
39 return nil
40 }
41
42 i := h.slice[0]
43 h.heapSize--
44
45 h.slice[0] = h.slice[h.heapSize]
46 h.updateidx(0)
47 h.heapifyDown(0)
48
49 h.slice = h.slice[0:h.heapSize]
50 return i
51}
52
53func (h *MaxHeap) Push(i Comparable) {
54 h.slice = append(h.slice, i)

Callers 1

DijkstraMethod · 0.95

Calls 2

updateidxMethod · 0.95
heapifyDownMethod · 0.95

Tested by

no test coverage detected