Search
Vaším úkolem je doprogramovat třídy implementující rozhraní Node podle následující specifikace:
Node
maxTreeDepth
LeafNode
minDepthOfLeafNode
maxAlternateTreeDepth
MarkerNode
alternateTreeDepthCopy
new InnerNode(ImmutableList.of(new LeafNode(), new MarkerNode(new LeafNode())))
new InnerNode(ImmutableList.of(new LeafNode(), new LeafNode()))
Odevzdávaný kód (rozhraní Node a třídy LeafNode, InnerNode a MarkerNode) uložte do svého repozitáře do souboru hw/Assignment10.java. Termín odevzdání je 25. 5. ve 24:00.
InnerNode
hw/Assignment10.java
import com.google.common.collect.ImmutableList; interface Node { int maxTreeDepth(); int minDepthOfLeafNode(); int maxAlternateTreeDepth(); Node alternateTreeDepthCopy(); } class LeafNode implements Node { } class InnerNode implements Node { final ImmutableList<Node> children; public InnerNode(ImmutableList<Node> children) { assert children.size() > 0; this.children = children; } } class MarkerNode implements Node { final Node child; public MarkerNode(Node child) { this.child = child; } }
~~DISCUSSION:ON~~