// maxHeapityRecurseBased to keep max heap properties recursed
// i is node index started by 1, only will be translated to 0 started index until operate array
maxHeapityRecurseBased to keep max heap properties recursed
i is node index started by 1, only will be translated to 0 started index until operate array
// maxHeapityRecurseBased to keep max heap properties recursed // i is node index started by 1 only will be translated to 0 started index until operate array
func (m *binaryHeap) maxHeapityRecurseBased(in myInterface, i int) {
	left := m.leftChild(i)
	right := m.rightChild(i)
	largest := i
	if left <= m.heapSize && in.Less(largest-1, left-1) { 
		largest = left
	}
	if right <= m.heapSize && in.Less(largest-1, right-1) { 
		largest = right
	}
	if largest != i {
		in.Swap(largest-1, i-1) 
		m.maxHeapityRecurseBased(in, largest)
	}
}
func ( m * binaryHeap ) maxHeapityRecurseBased ( in myInterface , i int ) { left := m . leftChild ( i ) right := m . rightChild ( i ) largest := i if left <= m . heapSize && in . Less ( largest - 1 , left - 1 ) { largest = left } if right <= m . heapSize && in . Less ( largest - 1 , right - 1 ) { largest = right } if largest != i { in . Swap ( largest - 1 , i - 1 ) m . maxHeapityRecurseBased ( in , largest ) } }
maxHeapityRecurseBased to keep max heap properties recursed
i is node index started by 1, only will be translated to 0 started index until operate array
maxHeapityRecurseBased to keep max heap properties recursed i is node index started by 1 only will be translated to 0 started index until operate array
// i will be the parent in the maxHeapity procedure // find largest from i,left,right // translate to 0 started index to operate array // translate to 0 started index to operate array // translate to 0 started index to operate array