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
*142 and 143. 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 1.)
*/
public static int depthSum(IntTree tree){
// TODO replace this with your code
throw new UnsupportedOperationException("Not implemented yet.");
}
/**
* Removes all leaf nodes from the given tree.
*/
public static void removeLeaves(IntTree tree){
// TODO replace this with your code
throw new UnsupportedOperationException("Not implemented yet.");
}

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!