For these problems, elegant implementation is expected.
Note in-order is for binary tree, but post-order is for any tree.
== Q: given Any tree without cycle, print the size of subtree at every node
I think post-order walk is usable.
== Q: given Any tree without cycle, print the height of subtree at every node. Also print the node address just for identification
Intuition — dft post-order walk. Need to become more familiar with the detailed steps. https://www.techiedelight.com/calculate-height-binary-tree-iterative-recursive/ has details.
== Q (Leetcode): Given a binary tree, determine if it is height-balanced — a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
I can try it on Leetcode .. no need to set up test harness myself but I might be frustrated
Intuition– post-order walk. A simple recursive algo — for any node, find the its subtree height including itself and return it. Before returning, also compare the left vs right subtree heights