求软院学生解答!Java的一道题
  • 浏览:2189 评论:9 人

  • 这里是它的类,第二个是它的测试类(JUnit测试)
    package com.hrbb.progtest.level3;import java.util.List;public class GetAverage { // Please do not change this interface public static interface Node { int getValue(); List<Node> getChildren(); } public static double getAverage(Node root) { /* Please implement this method to return the average of all node values (Node.getValue()) in the tree. */ return 0d; }}

    测试类
    package com.hrbb.progtest.level3;import org.junit.Test;public class GetAverageTest{@Testpublic void testEmptyTree() {}}




    我感觉吧...它只是实现了Node的接口...接口里面只有两个抽象方法...一个变量都木有定义...
    所以也无所谓是什么数据结构吧...你可以把它搞成链表...也可以搞成树...
    题目的意思是要你把它实现为树...