Write a program print the outsides nodes in a binary tree.
Respostas da entrevista
Sigiloso
13 de fev. de 2013
using DFS.
Sigiloso
15 de fev. de 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.
Sigiloso
30 de jul. de 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