Check Full Binary Tree

Java Implementation of checking if the given binary tree is full or not. class Solution { static class TreeNode{ int data; TreeNode left,right; TreeNode(int data) { this.data=data; } } static boolean isFullTree(TreeNode node) { if(node==null) return true; if(node.left==null && node.right==null) return true; if(node.left==null || node.right==null) return false; return isFullTree(node.left) && isFullTree(node.right); } public static void […]

Pin It on Pinterest