Question: What is the logical error in the findFun method? int findFun ( Node node ) { if ( node . key = = null )

What is the logical error in the findFun method?
int findFun (Node node){
if (node.key == null)
return 0 ;
else
{
int length =1;
length += findFun (node: node.left);
length += findFun (node: node.right);
return length;
A. The method counts all nodes instead of finding the maximum.
B. The method doesn't count the root node when finding the maximum.
C. The method doesn't count the leaf nodes when finding the maximum.
D. The method returns 0 instead of -1 for empty tree.
 What is the logical error in the findFun method? int findFun

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!