c**********e 发帖数: 2007 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q85: How to find common parent in a tree.
发信站: BBS 未名空间站 (Fri Sep 16 22:31:09 2011, 美东)
Find the nearest common parent to two given nodes in a tree. |
a***y 发帖数: 2803 | 2 tree也分很多种吧?
【在 c**********e 的大作中提到】 : 【 以下文字转载自 JobHunting 讨论区 】 : 发信人: careerchange (Stupid), 信区: JobHunting : 标 题: C++ Q85: How to find common parent in a tree. : 发信站: BBS 未名空间站 (Fri Sep 16 22:31:09 2011, 美东) : Find the nearest common parent to two given nodes in a tree.
|
c**********e 发帖数: 2007 | 3 How to do it in a binary search tree?
【在 a***y 的大作中提到】 : tree也分很多种吧?
|
c*******h 发帖数: 1096 | 4 http://en.wikipedia.org/wiki/Lowest_common_ancestor
我照着第2个external link里面说的写了一个,挺容易写的
【在 c**********e 的大作中提到】 : 【 以下文字转载自 JobHunting 讨论区 】 : 发信人: careerchange (Stupid), 信区: JobHunting : 标 题: C++ Q85: How to find common parent in a tree. : 发信站: BBS 未名空间站 (Fri Sep 16 22:31:09 2011, 美东) : Find the nearest common parent to two given nodes in a tree.
|