資料結構›Ch5 樹狀結構
第 9 題/共 48 題
◀ DS 9/48
9. Binary Tree、Re-rooting
#DS-05-009中Binary TreeRe-rooting

We have a binary tree TT and for every node v∈Tv \in T, we want to compute the new height if we select vv as the new root.

We consider the effect of making vv the new root. First, the height of the subtree of vv is still l(v)l(v). Second, since vv is now the new root, it could go up to its parent and then to the farthest leaf. We define this distance as r(v)r(v).

📄 台大113
跳轉到第題
▤完整推導請見《WH 資工筆記 · 資料結構》Ch5 樹狀結構
本章題號 · 1–20 / 48