This question was asked to me in an interview: I have a binary tree and I have to find the common ancestor (parent) given two random nodes of that tree. I am also given a point
Pre order traversal unless any 1 of the node is met and save the nodes visited uptil now.
Inorder traversal,start saving the nodes when any 1 (of the two provided nodes) node is met,and save the list until the next node is met.
A
B C
D E F G
H I J K L M N O
Suppose H and E are two random nodes.
Find the first node common in all three...