@Override
    protected void heapHeapify(int nodeIndex) {

        int leftIndex = getLeftChildIndex(nodeIndex);
        int rightIndex = getRightChildIndex(nodeIndex);

        if (rightIndex >= capacity) {
            return;
        }

        /* 
         To compare nodes with their natural ordering cast them into Comparable
         objects 
         */
        E left = (E) heap[leftIndex];
        E node = (E) heap[nodeIndex];

        int largestIndex;

        if (rightIndex < currentSize) {
            if (left.compareTo((E) heap[rightIndex]) < 0) {
                largestIndex = leftIndex;
            } else {
                largestIndex = rightIndex;
            }
            if (node.compareTo((E) heap[largestIndex]) > 0) {
                swap(nodeIndex, largestIndex);
                heapify(largestIndex);
            }
        } else if (leftIndex == currentSize - 1 && node.compareTo((E) left) > 0) {
            swap(nodeIndex, leftIndex);
        }
    }