public static void maxheap(int[] a, int i) { 
        left=2*i;
        right=2*i+1;
        if(left <= n && a[left] > a[i]) largest=left;  
        else largest=i;

        if(right <= n && a[right] > a[largest]) largest=right;
  
        if(largest!=i) {
            exchange(i,largest);
            maxheap(a, largest);
        }
    }