formatting source-code for e464ddac36

This commit is contained in:
github-actions 2020-06-20 18:34:51 +00:00 committed by Ayaan Khan
parent 38db7fdec0
commit 11728ee231

View File

@ -34,8 +34,7 @@
*
*/
auto printArray = [](int *arr, int sz) {
for (int i = 0 ; i < sz ; i++)
std::cout << arr[i] <<" ";
for (int i = 0; i < sz; i++) std::cout << arr[i] << " ";
std::cout << "\n";
};
@ -45,6 +44,8 @@ auto printArray = [] (int *arr, int sz) {
* the bottom up by successively sifting downward to establish the
* heap property.
*
* @param arr array be to sorted
* @param
*/
void (*heapify)(int *arr, int n, int i) = [](int *arr, int n, int i) {
int largest = i;
@ -72,8 +73,7 @@ void(*heapify)(int *arr, int n, int i) = [] (int *arr, int n, int i) {
*
*/
auto heapSort = [](int *arr, int n) {
for (int i = n-1 ; i >= 0; i--)
heapify(arr, n, i);
for (int i = n - 1; i >= 0; i--) heapify(arr, n, i);
for (int i = n - 1; i >= 0; i--) {
std::swap(arr[0], arr[i]);