private static void sink(Comparable[] a, int k, int N){
        //bounds error check: are there still children in array
        //k is parent idx
        while(2*k <= N){
            int j = 2*k; //idx j is child of parent k
            
            //pick the smaller of the 2 children
            if( j < N && less(a, j, j+1) )      j++;

            //exit loop condition
            if(!less(a, k, j))                  break;

            //swap elmt at parent and child idx
            swap(a, k, j);

            //update parent idx
            k = j;
        }
    }