Prefix Expressions

This is a discussion on Prefix Expressions within the C++ Programming forums, part of the General Programming Boards category; Hi the description of an assignment which I have to complete is shown below. I just need some help getting ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    16

    Prefix Expressions

    Hi the description of an assignment which I have to complete is shown below. I just need some help getting started, will I have to use a stack, queue, or both?

    Write a program to recognize and evaluate prefix expressions. You can assume that operands are single digits, and the operators are +, -, *, /. Use a class for prefix expressions.

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    16
    furthermore should I use an array or linked-list implementation

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    i'd vote for a queue based on a linked list, but the instructions you give don't limit it to that.

  4. #4
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    I'd also suggest a queue, however you can also use a binary tree.

  5. #5
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,157
    I'd use a stack.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack that evaluates postfix expressions
    By killmequick in forum C Programming
    Replies: 7
    Last Post: 10-01-2008, 06:23 PM
  2. Atomic Operations
    By Elysia in forum Windows Programming
    Replies: 27
    Last Post: 03-27-2008, 02:38 AM
  3. Evaluating Prefix expressions
    By deane034 in forum C Programming
    Replies: 8
    Last Post: 05-04-2007, 03:31 PM
  4. Regular expressions [Boost]
    By Desolation in forum C++ Programming
    Replies: 8
    Last Post: 12-30-2006, 09:10 PM
  5. Help please: regular expressions in C++
    By reivaj7999 in forum C++ Programming
    Replies: 3
    Last Post: 08-24-2005, 01:11 AM

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