資料結構›Ch5 樹狀結構第 9 題/共 48 題
9. Binary Tree、Re-rooting
#DS-05-009中Binary TreeRe-rooting
We have a binary tree and for every node , we want to compute the new height if we select as the new root.
We consider the effect of making the new root. First, the height of the subtree of is still . Second, since is now the new root, it could go up to its parent and then to the farthest leaf. We define this distance as .
📄 台大113
▤完整推導請見《WH 資工筆記 · 資料結構》Ch5 樹狀結構