题目:输入二叉树中的两个结点,输出这两个结点在数中最低的共同父结点。 typedef struct BinTreeNode { int data; struct BinTreeNode *pLeft; struct BinTreeNode *pRight; }*pBinTreeNode; BinTreeNode * getLCA(BinTreeNode * root, BinTreeNode * X, BinTreeNode *Y) { if (root == NULL) return NULL; if (X == root || Y == root) return root; BinTreeNode * left = getLCA(root->pLeft, X, Y); BinTreeNode * right = getLCA(root->pRight, X, Y); if (left == NULL) return right; else if (right == NULL) return left; else return root; }