Close

Right view of the binary tree

Given a binary tree, how do we print the right view of it?For example, consider the simple binary tree below    1 / 2   3 The right view of this is 1, 3. Similarly consider one more example             1          /           2    5        /          3   4  Right view for this tree contains…

Left view of a binary tree

Given a binary tree, how do we print the left view of it?For example, consider the simple binary tree below    1 / 2   3 The left view of this is 1, 2. Similarly consider one more example             1          /           2    3             /             4   5Left view for this tree contains 1, 2,…