二叉树祖先节点
Problem statement:
问题陈述:
Given a Binary Tree and a target key, write a function that prints all the ancestors of the key in the given binary tree.
给定二叉树和目标键,编写一个函数,以打印给定二叉树中键的所有祖先 。
Example:
例:
Let's the tree be like following:
让树如下所示:
Let for node value 12:
Ancestors are:
7, 5, 8
While for node value 7:
Ancestors are:
5, 8
Solution
解
What is Ancestors?</