Given a Binary Tree, print Right view of it. Right view of a Binary Tree is set of nodes visible when tree is visited from Right side
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Right view of a binary tree
Right view of a binary tree means the nodes which are visible when tree is view from right direction only.
The above problem can be solved using level order traversal. For every level traversed, print only the rightmost node.
Algorithm
Pre-requisite:
A Queue, input binary tree
C++ implementation:
Output
Example with explanation