public boolean isPerfect(Comparable[] flatTree) 
    {

        boolean answer = false;
        for (int i = 1; i < flatTree.length; i++) 
        {
            Comparable current = flatTree[i];
            Comparable left = getLeftKid(i,flatTree);
            Comparable right = getRightKid(i,flatTree);
            
            
            if (hasBothKids(i, flatTree))
            {
                answer = true;
            }
            
            if (hasNoKids(i,flatTree))
            {
                answer = true;
            }
            
             if (isRoot(i))
            {
                answer = true;
            }
             if (hasOneKid(i,flatTree))
            {
                answer = false;
            }
            
            
        }
        return answer;
    }