evalutaing a prefix expression

This is a discussion on evalutaing a prefix expression within the C Programming forums, part of the General Programming Boards category; Is there an algorithm to evaluate a prefix expression. I googled and i could find a lot on evaluating a ...

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    18

    evalutaing a prefix expression

    Is there an algorithm to evaluate a prefix expression. I googled and i could find a lot on evaluating a postfix expression using a stack. Thats cool, but i found almost no info on evaluating a prefix expression.

    For example,
    if the prefix expression is : +-/+abcd*fg,
    the infix should be evaluated as (a+b)/c-d+(f*g)

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,490
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,302
    I know you Googled, but so did I, and here's what I got:
    evaluate prefix expression - Google Search

    The first result was a lengthy article from dreamincode.net explaining the process.
    The second result was a Wikipedia article with some pseudo code for prefix evaluation.
    The third was a MS Word doc from University of Bridgeport explaining the process and giving pseudo code.
    The list goes on...

    If you need specific help, make a decent effort, post your code in code tags and ask a specific question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. initializer expression list treated as compound expression
    By karthikeyanvisu in forum C Programming
    Replies: 7
    Last Post: 02-26-2011, 04:19 PM
  2. Replies: 2
    Last Post: 11-25-2009, 06:38 AM
  3. How to evaluate a postfix|prefix expression using stack?
    By Marrah_janine in forum C Programming
    Replies: 5
    Last Post: 08-04-2007, 04:12 AM
  4. which to prefix with std:: ??
    By wakish in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2005, 02:58 PM

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