Skip to content

Latest commit

 

History

History
13 lines (11 loc) · 306 Bytes

File metadata and controls

13 lines (11 loc) · 306 Bytes

Given a Binary Tree and a key, write a function that prints all the ancestors of the key in the given binary tree.

if the given tree is following Binary Tree and key is 7, then 2nd Ancestor is 2.


              1
            /   \
          2      3
        /  \
      4     5
     /
    7