Lowest Common Ancestor of a Binary Tree
摘要:
Given a binary tree, find the lowest common ancestor of two given nodes in the tree. 1 // This function returns pointer to LCA of two given values n1 and n2. 2 // This function assumes that n1 and n2 are present in Binary Tree 3 struct Node *findLCA(struct Node* root, int n1, int n2) 4 { 5 // Ba... 阅读全文
posted @ 2014-03-18 08:55 longhorn 阅读(172) 评论(0) 推荐(0) 编辑