MCPcopy
hub / github.com/TheAlgorithms/Go / Init

Method Init

sort/heapsort.go:17–26  ·  view source on GitHub ↗
(slice []Comparable)

Source from the content-addressed store, hash-verified

15}
16
17func (h *MaxHeap) Init(slice []Comparable) {
18 if slice == nil {
19 slice = make([]Comparable, 0)
20 }
21
22 h.slice = slice
23 h.heapSize = len(slice)
24 h.indices = make(map[int]int)
25 h.Heapify()
26}
27
28func (h MaxHeap) Heapify() {
29 for i, v := range h.slice {

Callers 1

DijkstraMethod · 0.95

Calls 1

HeapifyMethod · 0.95

Tested by

no test coverage detected