Below is the IntTree class we discussed in week 3 and that you worked on in HW3. We are in the middle of implementing a new recursive method called leafCount that should return the number of leaves in the tree. What code should replace the comment /* recursive case */ so that the leafCount method works correctly? return tempL + 1; return tempL + tempR + 1; return tempL + tempR; return tempR + 1;
Below is the IntTree class we discussed in week 3 and that you worked on in HW3. We are in the middle of implementing a new recursive method called leafCount that should return the number of leaves in the tree. What code should replace the comment /* recursive case */ so that the leafCount method works correctly? return tempL + 1; return tempL + tempR + 1; return tempL + tempR; return tempR + 1;
Related questions
Question
Below is the IntTree class we discussed in week 3 and that you worked on in HW3. We are in the middle of implementing a new recursive method called leafCount that should return the number of leaves in the tree. What code should replace the comment /* recursive case */ so that the leafCount method works correctly?
return tempL + 1; |
|
|
return tempL + tempR + 1; |
|
return tempL + tempR; |
|
return tempR + 1; |
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps