Pregunta de entrevista de Google

Write a program print the outsides nodes in a binary tree.

Respuestas de entrevistas

Anónimo

13 feb 2013

using DFS.

Anónimo

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.

Anónimo

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