Home » Programming & Data Structure » Programming and data structure miscellaneous » Question

Programming and data structure miscellaneous

Programming & Data Structure

  1. Consider the following New-order strategy for traversing a binary tree :
    • Visit the root;
    • Visit the right subtree using New-order;
    • Visit the left subtree using New-order;
    The New-order traversal of the expression tree corresponding to the reverse polish expression 3 4 * 5 – 2 ^ 6 7 * 1 + – is given by :
    1. + – 1 6 7 * 2 ^ 5 – 3 4 *
    2. – + 1 * 6 7 ^ 2 – 5 * 3 4
    3. – + 1 * 7 6 ^ 2 – 5 * 4 3
    4. 1 7 6 * + 2 5 4 3 * – ^ –
Correct Option: C

The expression tree for the given post-fix expression is as follows :

New-order of shown expression tree is – + 1 * 7 6 ^ 2 – 5 * 4 3



Your comments will be displayed only after manual approval.