import java.io.*; import java.util.*; class HeapSrt { public int[ ] arr; public HeapSrt(int MAX) { arr=new int[MAX]; } public void makeheap(int n) { int val,j,father; for(int i=1; i0&&arr[father]0; i—) { temp=arr[i]; arr[i]=arr[0]; k=0; if(i==1) j=-1; else j=1; if(i>2&&arr[2]>arr[1]) j=2; while(j>=0&& temp i-1) j=-1; } arr[k]=temp; } } /* ---------------------------------------------------------------------------------- display: function for displaying the elements ---------------------------------------------------------------------------------- */ public void display(int n) { for(int i=0; i