Skip to content

Latest commit

 

History

History

Print Ancestors of A Given Node

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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 your function should print 4, 2 and 1.


              1
            /   \
          2      3
        /  \
      4     5
     /
    7