Hit point: To prove these ideas:
- for some node P, all node in the subtree of Node p are appearing consecutive in bamboo tree.
- We named the consecutive nodes built up a section in bamboo tree.
- If node-A have three child: P, Q, R. The section of P, Q, R will range one by one in bamboo tree: A,[P],[Q],[R] or A[Q][R][P] or ...
- We assume 2 scenario:
- The right answer of bamboo is A,[P],[Q],[R]. The number of steps we move [Q] to A + defragment [P]
- The right answer of bamboo is A,[Q],[P],[R]. The number of steps we move [Q] to A + defragment [P]
- Are equal.
An easy reading graphic and code are on my blog : https://blog.vrqq.org/archives/520/ (With Chinese explanation)



