Consider the following New-order startegy for traversing a binary tree.
The New-order traversal of the expression tree corresponding to the reverse polish expression
(3 4 * 5 - 2 ^ 6 7 * 1 + -)
is given by
A
1 7 6 * + 2 5 4 3 * - ^ -
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
+ - 1 6 7 * 2 ^ 5 - 3 4 *
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
- + 1 * 6 7 ^ 2 - 5 * 3 4
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
- + 1 * 7 6 ^ 2 - 5 * 4 3
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution
The correct option is D - + 1 * 7 6 ^ 2 - 5 * 4 3 Reverse polish expression is another name for postfix notation. Since postfix notation is similar to postorder (LEFT, RIGHT, ROOT) and new order strategy is (ROOT, RIGHT, LEFT), both are reversals of each other.
Hence option (c) is the correct answer.