0

First of all, this is not for any class. I have been working on these 2 programs for a long time and cannot make heads or tails of it. I really want to get past these problems so I can move onto other lessons. "Create a function that transforms the prefix notation into postfix notation, and postfix notation into prefix notation. The function takes two arguments. The first is a string of an expression without spaces or syntax errors, and the second is another string contains all the operators. Characters not in the second string are regarded as operands. The lengths of all the operators and operands are 1, and all the operators are binary operators." ex:

>>> fix_trans('ab33c2c11','abc')
'33b211cca'

and Convert to (reverse) Polish notation:

>>> toPolish('(3+5)*(7-2)',D,0)
'*+35-72'
4

1 回答 1

0

你能提供任何例子来说明你在这方面取得了多大的进步,或者哪些方法对你不起作用?另外,你熟悉调车场算法吗?

于 2013-03-13T03:35:22.393 回答