// HeapSort implements Sort by MaxHeap in-place
HeapSort implements Sort by MaxHeap in-place
// HeapSort implements Sort by MaxHeap in - place
func HeapSort(in myInterface) {
	if in.Len() <= 1 {
		return
	}
	bh := binaryHeap{}
	bh.maxHeapity = bh.maxHeapityLoopBased 
	bh.buildMaxHeap(in) 
	for i := in.Len(); i >= 2; i-- { 
		in.Swap(0, i-1) 
		bh.heapSize--
		bh.maxHeapity(in, 1)
	}
}
func HeapSort ( in myInterface ) { if in . Len ( ) <= 1 { return } bh := binaryHeap { } bh . maxHeapity = bh . maxHeapityLoopBased bh . buildMaxHeap ( in ) for i := in . Len ( ) ; i >= 2 ; i -- { in . Swap ( 0 , i - 1 ) bh . heapSize -- bh . maxHeapity ( in , 1 ) } }
HeapSort implements Sort by MaxHeap in-place
HeapSort implements Sort by MaxHeap in - place
//switch loop or rescurse based maxheapity here // first build max heap // 1 started index here // move biggest element to the end // then find the biggest and move it to root again //bh.maxHeapityRecursed(in, 1) //bh.maxHeapityLoopBased(in, 1)