Print Ancestor of given node value in binary tree

Print Ancestor of given node value in binary tree.

For Given Binary Search tree find out the ancestor of a given node value .

Binary Search Tree , 8 is root node ,left branch has nodes whose value are less than 8 and right branch has nodes whose values are greater than 8
Binary Search Tree

 

Node Value                O/P

4                                    8  3  6

13                                8  10  14

 

Recursive function to print ancestor values for given binary search tree.

 

Complete code with binary search tree implementation and ancestor printing function.