Given a binary tree and a node, print all the ancestors of that node.

1
/ \
4 5
/ \ / \
2 3 7 8

print all the ancestors of 7 ans:1 5 7

Click for Solution
[Insert Code]