Question: import java.util.*; public class PoD { //============================================================================= /** * Returns true if the binary tree is a strict binary tree, in which * each node

 import java.util.*; public class PoD { //============================================================================= /** * Returns trueif the binary tree is a strict binary tree, in which *each node in the tree has either zero or two children. *@param bTree BinaryTree of interest * @return boolean true if strict binarytree, false otherwise */ public static boolean isStrictBinaryTree(BinaryTree bTree) { } //=============================================================================

import java.util.*; public class PoD { //============================================================================= /**  * Returns true if the binary tree is a strict binary tree, in which  * each node in the tree has either zero or two children.  * @param bTree BinaryTree of interest  * @return boolean true if strict binary tree, false otherwise  */   public static boolean isStrictBinaryTree(BinaryTree bTree) { } //============================================================================= public static void main( String [] args ) { Scanner in = new Scanner( System.in ); int i = in.nextInt(); int j = in.nextInt(); BinaryTree newBT = makeBT(i,j); boolean isStrictBT = isStrictBinaryTree(newBT); if (isStrictBT) { System.out.println("Strict binary tree"); } else { System.out.println("NOT a strict binary tree"); } in.close(); System.out.print("END OF OUTPUT"); } public static BinaryTree makeBT(int n, int k) { BinaryTree b; if ((n>0) && (n%2==0)) { b = new BinaryTree(n,makeBT(n-1,k),makeBT(n-2,k)); } else if (n>0 & n%2==k) { b = new BinaryTree(n, null, makeBT(n - 2,k)); } else { b = new BinaryTree(0,null,null); } return b; } }

Today you are going to take a look at a binary tree and decide if it is a strict binary tree or not. Strict binary tree A binary tree is considered a strict binary tree if each node in the tree has either zero or two children. n other words: If either subtree is empty, both left and right subtrees are empty If neither are empty, both the left or right subtrees are each strict binary trees as well. Details Download the ZIP files named FilesNeeded.zip for use in Intellij. When you are happy with your solution, upload the files into the src folder and run. You are going to finish off PoD.java to finish the isStrictBinaryTree method Input The main method (already completed) creates a binary tree and passes that binary tree to the isStrictBinary Tree method. Processing You are going to complete the details of isStrictBinaryTree method. Details of each method and their expected parameters are described in the Javadoc comments preceding it. The method should return true if the binary tree is a strict binary tree and return false if it is not

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!