Skip to main content

Posts

Featured

Left View of Binary Tree

Q: Given a Binary Tree, print left view of it. Left view of a tree is nodes visible when tree is viewed from the left side Below example illustrates this better. fig (a) shows a binary tree, which when viewed from left the highlighted nodes are the output i.e. 1, 2, 4 as shown in fig(b) to better view this we can take next example: as shown if binary tree in fig (c) is viewed from the left the output would be as highlighted in fig (d) Solution: As can be seen in above example, the output is always the first node that appears at a level.

Latest Posts