[Tutor] Postfix notation [was: Re: the big o]
Alan Gauld
alan.gauld at btinternet.com
Wed Jul 29 01:43:07 CEST 2015
On 28/07/15 20:08, Quiles, Stephanie wrote:
Hoi Stephanie,
Please start a new topic on a new thread/subject.
It makes funding stuff in the archives much easier.
> ...if someone could please make it a little easier to figure out postfix and infix?
> My homework assignment asks me to convert from infix to postfix. ...
> Here is an example A+B/C*D-E+F
>
> I thought it was something like ABC/+ cd*ef+-??
>
If I work this back correctly it translates as:
(A+B/C) (C*D)-(E+F)
which seems to miss an operation? It also uses C twice.
The first thing you need to do it work out how to put parens
on the original to express the precedence precisely. Then
the postfix format should pretty much drop out.
Do you have access to an RPN calculator(emulator)?
That will help you test it. If on *nix try xcalc -rpn
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list