So there s the mission. We have a class, call "Node", the instance is "node". This node has a lot of children, and these children have a lot of children too, etc etc. How could I SUM the all children number in this tree? example:
- node -> child1 -> child1.1 -> child1.1.1, child 1.1.2 -> child1.1.2.1
- node -> child2
- node -> child3 -> child3.1, child3.2 -> child3.2.1
the number of the all children is 10 (node is the parent). please help me someone, and write the current answer with java recursion. The program should start with:
public int childrenNumber(Node node){...