Changing (post/pre)fix expressions to infix

This is a discussion on Changing (post/pre)fix expressions to infix within the C Programming forums, part of the General Programming Boards category; Hi, I've been trying to figure this out for hours allready & couldn't. I need to use manual transformation to ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    46

    Question Changing (post/pre)fix expressions to infix

    Hi,

    I've been trying to figure this out for hours allready & couldn't.
    I need to use manual transformation to change the following post/pre fix expressions to infix.
    Any help is much appreciated! Thanks soo much


    ABC +* D
    + *ABCD
    *A+BCD

    Thanks again!

  2. #2
    Registered User
    Join Date
    Jul 2004
    Posts
    91
    well postfix expression means that the operators come after the variables
    and prefix means that hte operators come before the variables
    so
    ABC +* D - would be postfix
    infix = ((A+B)*C)-D
    you just grab a letter and then grab the first operator you see,
    so A then + then B then * then C then - then D, and you put the brackets in.
    pre fix is simliar but the opposite

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    well let me give a clue.. you can use stacks to solve this...
    search the web for reverse polish and polish notation algorithms...

  4. #4
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    Quote Originally Posted by paperbox005
    well postfix expression means that the operators come after the variables
    and prefix means that hte operators come before the variables
    so
    ABC +* D - would be postfix
    infix = ((A+B)*C)-D
    you just grab a letter and then grab the first operator you see,
    so A then + then B then * then C then - then D, and you put the brackets in.
    pre fix is simliar but the opposite
    Thanks, but I don't think that's the answer as i've tried reversing the infix notation back to postfix to check the answer & it doesn't add up.
    & aren't the brackets supposed to be by operator precendence : ((A + (B*C))D ??

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    Quote Originally Posted by vasanth
    well let me give a clue.. you can use stacks to solve this...
    search the web for reverse polish and polish notation algorithms...
    I know , as im studying data structures right now with pseudocode in C.
    But I need to be able to do this by manual transformation.

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    So can someone please still help me with this ?

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I don't see any code, which means you obviously haven't bothered to read the Announcements.

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    Sorry I don't have code , it's just a question . Hope I didn't bother you too much

  9. #9
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    So what exactly was the question? It sounded like you wanted everyone to post code for you. I mean, it's not like you said "I don't understand how this algorithm works" or "I don't understand postfix/infix". You were already told what to search for, which you didn't do, because if you had, you wouldn't have followed up with "Can anyone help me?"

    NO. We will not give you the code for it. Do it yourself. When you get stuck, post your attempt. Otherwise, do as you've been instructed, and go look it up.

    Quzah.
    Hope is the first step on the road to disappointment.

  10. #10
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    You don't understand , I don't have too write code , just find the infix expressions to the post/prefix expressions I posted in my first post.

  11. #11
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    So why again did you post this on the C board?

    Quzah.
    Hope is the first step on the road to disappointment.

  12. #12
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    Your feeling so superior aren't you ,because you know C?

  13. #13
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,162
    I think what quzah is getting at is: why come to a programming board if you're not looking for help with a program? Shouldn't you be at a math site or something instead?

    It's kind of like going to the dentist for a broken leg.
    If you understand what you're doing, you're not learning anything.

  14. #14
    Registered User
    Join Date
    Jul 2004
    Posts
    46
    The book is Data structures, a pseudocode aproach with C . So no, im at the right site.

  15. #15
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by Cmuppet
    The book is Data structures, a pseudocode aproach with C . So no, im at the right site.
    No you're not. Since you just said you don't want the code for it, then NO, you are not at the right site. I don't care what book you are reading from. If you do not want code, or help with code then stop posting on a programming forum.

    You don't want code. You already said that. This isn't a "data structures" forum. It's a C Programming forum. You don't want C, you want to understand the concept itself. You don't want to use the tools, or to actually build something. You want to know how to read a blueprint. Now do you understand why you're in the wrong place?

    Someone lock this thread.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Expression: Convert infix notation to postfix notation.
    By Nutshell in forum C Programming
    Replies: 7
    Last Post: 02-27-2010, 06:44 AM
  2. Regular expressions [Boost]
    By Desolation in forum C++ Programming
    Replies: 8
    Last Post: 12-30-2006, 09:10 PM
  3. infix evaluation using stack
    By lewissi in forum C++ Programming
    Replies: 0
    Last Post: 11-03-2005, 01:56 AM
  4. Changing windows without changing?
    By Lionmane in forum Windows Programming
    Replies: 7
    Last Post: 10-19-2005, 11:41 AM
  5. Infix to Postfix
    By dat in forum C Programming
    Replies: 6
    Last Post: 06-16-2003, 08:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21