public static int getMaxdepth(Node root)
{
if(root!=null)
{// max the left and right of the tree; the max is the max of left and right tree
return 1+Math.max(getMaxdepth(root.left_child), getMaxdepth(root.right_child));
}
else
{// if it is null return 0;
return 0;
}
}
public static int getMindepth(Node root)
{
if(root!=null)
{
return 1+Math.min(getMindepth(root.left_child), getMindepth(root.right_child));
}
else
{
return 0;
}
}