t H e — C o M p L e T e — I n F o


      

advanced algoritm designing (AAD)

PROGRAM FOR THE HEAP SORT

#include<iostream.h> #include<conio.h> int arr[20], n; class heap { private: int loc, num, par; public: void del_root(int); void create_heap(); void display(); void heap_sort(); void insert(int, int); }; void heap :: insert(int num, int loc) { int par; while(loc > 0) { par = (loc – 1) / 2; if(num <= arr[par]) { arr[loc] = num; return; […]