I need to solve a bigger algorithm and one of the steps is count nodes in each subtree I dont need the code to do it but I need help to understand
The exercise is like this:

basically i need to return a new tree , each node containing the value of the node , and the number of elements in the left subtree and number of elements in the right subtree.
this is the method
public AB NumberOnEachSubtree(NodeAB a,NodeAB b) {
}
i think i can make the subtree in the first line of code and then add each node as I go trough the orignal tree, when you come back in recursion count number of nodes
but I dont have idea how to do it.. help
each node has left node and right node and numberNodesLeft and numberNodesRight