Closed baljaa1234 closed 4 years ago
#include <stdio.h> int number = 9; int heap[9] = {7, 6, 5, 8, 3, 5, 9, 1, 6}; int main(void) { for(int I = 1; i < number; I++) { int c = I; do{ int root = (c - 1)/ 2; if(heap[root] < heap[c] ) { int temp = heap[root]; heap[root] = heap[c]; heap[c] = temp; } c = root; } while (c !=0); }