void HeapSort::Sort(std::vector<BinaryTreeChromosome *>* array, size_t size){ to_heap(array, size); size_t end = size - 1; while (end > 0) { std::swap(array->at(0), array->at(end)); shift_down(array, 0, end); --end; } }
void heap_sort(int arr[], int N) { to_heap(arr, N); int end = N - 1; while (end > 0) { std::swap(arr[0], arr[end]); shift_down(arr, 0, end); --end; } }