Question: A full trinary tree has no missing nodes, i.e., all interior nodes have three children and all leaf nodes are at the same level as

A full trinary tree has no missing nodes, i.e., all interior nodes have three children and all leaf nodes are at the same level as shown in these examples:

 A A A /|\ /|\ B C D / | \ / | \ B C D /|\ /|\ /|\ E F G H I J K L M 

Implement the generic isFullTriTree method below so that it returns true if the trinary tree is full, false otherwise.

public static  boolean isFullTriTree(TrinaryTreenode n) { //TODO: COMPLETE THIS METHOD } 

The method is passed a reference to a TrinaryTreenode that is the root of the tree.

The TrinaryTreenode class is implemented as partially shown below:

class TrinaryTreenode  { // *** fields *** private T data; private TrinaryTreenode leftChild; private TrinaryTreenode midChild; private TrinaryTreenode rightChild; // *** methods *** public T getData() { return data; } public TrinaryTreenode getLeft() { return leftChild; } public TrinaryTreenode getMid() { return midChild; } public TrinaryTreenode getRight() { return rightChild; } } 

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!