Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions