confusion with prefix and postfix

Discussion in 'Computing and Networks' started by zulfi100, Feb 18, 2013.

  1. zulfi100

    Thread Starter Member

    Jun 7, 2012
    320
    0
    Hi,
    I have got some cofusion with this topic, although i have studied it.
    I want to use this forum to remove my confusion.
    For example consider the following infix notation:
    Code ( (Unknown Language)):
    1.  
    2. (5+4) * 8
    3.  
    In my opinion, its answer can be
    854+* , this is verified from its evaluation algorithm also. However correct answer is
    54+8*. I am confused about deciding the position of operand. If the position of operand in
    the infix notation determines its position in the postfix notation then following prefix notation is write
    for the infix notation
    Code ( (Unknown Language)):
    1.  
    2. B+C*D
    3.  
    prefix:
    +B*CD. However its answer is
    +*CDB. So my confusion is how to decide the position of operand 8(for postfix) and B (for prefix notation.
    Kindly guide me.
    Zulfi.
     
Loading...