In prefix notation the operator is written before its operands. Therefore, in order to print the prefix expression from an expression tree, preorder traversal is done. That is, at every non-terminal node we do the following:
While this notation may appear unfamiliar at first, consider the result obtained when we spell out the names of the operators:
plus (div (a,b), times (minus (c,d), e))This is precisely the notation used in a typical programming language to invoke user defined methods plus, minus, times, and div.