|
||
Title: REMOVE PARENTHESES Post by arvindwu on Nov 1st, 2008, 1:56am how to remove redundent parentheses (A+B) = A+B (A+(B*C) ) = A+B*C ((A+B)*C) = (A+B)*C A/(B+C) = A/(B+C) |
||
Title: Re: REMOVE PARENTHESES Post by towr on Nov 1st, 2008, 4:13am Build a tree from the expression, and then use precedence rules:
e.g. If the parent node (P) has the operator *, then a child (C) with operator + needs to be enveloped in parentheses when it's either the left (l) or right (r) child. If the parent node (P) has the operator /, then a child (C) with operator * needs to be enveloped in parentheses only if it's the right (r) child, but not when it's the left (l). |
||
Title: Re: REMOVE PARENTHESES Post by towr on Apr 5th, 2013, 6:21am I'm getting the distinct impression you're just spamming... I can't remember any of your posts contributing anything, it's all "I agree", "thanks", "I didn't know that". |
||
Title: Re: REMOVE PARENTHESES Post by Grimbal on Apr 7th, 2013, 7:09am Me too. I even started to removed this kind of posts where there is no contribution to the subject. PS: oops, I was cleaning up this kind of messages and I accidentally deleted the message you were commenting on. For info, towr was replying to Mariko79 who just quoted towr's previous message and said something like "Thanks, buddy". |
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |