You can restore the infix expression from the postfix expression calculated, only add parenthesis when necessary in each step.


On 2010-6-3 15:35, divya jain wrote:


1.calculte the postfix of given expression.
2.now remove a particular parenthesis from expression and check if the postfix of this expression is equal to the postfix of original expression. if yes then the parenthesis we have removed were extra. if no then the parenthesis were not exta. 3 now remove other parenthesis as step 2 and repeat till u have done this for all parenthesis

On 1 June 2010 20:12, Raj N <[email protected] <mailto:[email protected]>> wrote:

    How to remove extra parentheses in an infix string. For example if it
    is A+(B*C) parentheses for * is not required as it has higher
    precedence. Can someone suggest a good routine for this?

    --
    You received this message because you are subscribed to the Google
    Groups "Algorithm Geeks" group.
    To post to this group, send email to [email protected]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:algogeeks%[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/algogeeks?hl=en.


--
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.

--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to