For binary heap, heapify-up, heapify-down, insert, deletemin/max, heap sort
pls give examples with solutions in C
Answer
Answer:
The complete code for heap sort is given below, which includesinsert/delete, and heapify.
please have a look and let me know if further assistance isrequired.
code:
#include <iostream>
using namespace std;
void heapifyArray(int array[], int a, int m) // a is the size ofthe heap, hepify will be done of the root node with the nodepresent at the index m
{
int large = m; // Root will be initialized as largest
int leftChild = 2*m + 1; // Assign left child
int rightChild = 2*m + 2; // Assign right child
if (leftChild
OR
OR