Write a program print the outsides nodes in a binary tree.
Interview Answers
Anonymous
13 Feb 2013
using DFS.
Anonymous
15 Feb 2013
Level order traversal with two array like buffers - one for level i and other for level i+1.
store nodes in level ordered fashion in array and print 0th and (n-1)th element of that array.
Anonymous
30 Jul 2013
Parag, that won't work, you might have leaf nodes at height-2 or higher.
Here's a solution that uses pre-order traversal:
http://www.fusu.us/2013/07/printing-binary-tree-boundary.html