Question: / * * * See the spec on the website for tips and example behavior. * * Also note: you may want to use private
See the spec on the website for tips and example behavior.
Also note: you may want to use private helper methods to help you solve these problems.
YOU MUST MAKE THE PRIVATE HELPER METHODS STATIC, or else your code will not compile.
This happens for reasons that aren't the focus of this assignment and are mostly skimmed over in
and If you want to know more, you can ask on the discussion board or at office hours.
REMEMBER THE FOLLOWING RESTRICTIONS:
do not call any methods on the IntTree objects
do not construct new IntTreeNode objects though you may have as many IntTreeNode variables
as you like
do not construct any external data structures such as arrays, queues, lists, etc.
do not mutate the data field of any node; instead, change the tree only by modifying
links between nodes.
public class IntTreeProblems
Computes and returns the sum of the values multiplied by their depths in the given tree.
The root node is treated as having depth
public static int depthSumIntTree tree
TODO replace this with your code
throw new UnsupportedOperationExceptionNot implemented yet.";
Removes all leaf nodes from the given tree.
public static void removeLeavesIntTree tree
TODO replace this with your code
throw new UnsupportedOperationExceptionNot implemented yet.";
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
