最小共通祖先
元々は AtCoder Beginner Contest 014 のために調べ始めたのだが、同じ問題に対して解法が多すぎる…
- GeeksforGeeks にも以下のようなシリーズがある
- 二分木における最小共通祖先: Lowest Common Ancestor in a Binary Tree - Set 1
- 二分木における2つのノードの距離を取得する: Find distance between two nodes of a Binary Tree
- 二分木における最小共通祖先をRMQで取得する: Find LCA in Binary Tree using RMQ
- 二分木における最小共通祖先(スパゲッティスタックを使用して): Lowest Common Ancestor in a Binary Tree - Set 2 (Using Parent Pointer)
- タージャンのオフライン最小共通祖先アルゴリズム: Tarjan’s off-line lowest common ancestors algorithm