I think all the answers are wrong. Also pre-order is probably the wrong term here. The conventional term is prefix or Polish notation.
You'd break up this expression at the level of lowest precedence as: (A - B) - C where A = ~16, B = ~14 / ~12, and C = 2 * 8 . Note I'm using ~ for unary negation because prefix notation is ambiguous if you can't tell a unary minus from a binary minus (and you aren't using parentheses like lisp). In prefix this is "- - A B C". Term A is already in prefix. Term B in prefix is "/ ~14 ~12" Term C is "* 2 8". Substituting you get - - ~16 / ~14 ~12 * 2 8 Now if you instead broke up the top level as A - (B - C) the prefix is - A - B C so you'd get the third answer - ~ 16 - / ~14 ~12 * 2 8 But for this to be correct the problem would have to say that subtraction is _right_ associative. Normally it's not. I.e. 1 - 2 - 3 is -4, not 2. On Feb 9, 8:28 am, Rahul Menon <menonrahul1...@gmail.com> wrote: > From the following options, select the correct pre-order > representation of > the following expression. > > – 16 – – 14 / – 12 - 2 * 8 > Please do answer how you arrived at the answer! > > Answers > - –16--/14–12*28 > - –16--/-1412*28 > - –16 - / –1 4 –1 2 *28 > */--–16-14–1228 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.