Showing posts with label Binary Tree. Show all posts
Showing posts with label Binary Tree. Show all posts

Tuesday, October 23, 2012

Least Common Ancestor in Binary Tree

Given a Binary Tree (not Binary Search Tree), and two nodes A and B. Find the closest common ancestor for both the nodes.

Solution


Binary Tree - Microsoft Interview Questions

This one contains 3 different problems on a complete Binary Tree.
1. Create and Print a Binary Tree in the same input order.
2. Print the tree in a zig-zag fashion. Even levels right to left and Odd levels left to right
3. Take a snapshot of the tree and put it on a co-ordinate system with left-most node as (0,0)

Solution



UA-36403895-1