Show Bid Request
Expression Evaluation using Stacks
Bid Request Id: 25974
|
|
|
Posted by: |
seatiger74 (25 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Very Good - 3.23%
|
Buyer Security Verifications: |
Good
|
Approved on: |
Aug 31, 2002 11:54:48 AM EDT
|
Bidding Closes: |
Sep 2, 2002 12:06:34 PM EDT
|
Viewed (by coders): |
293 times
|
Deadline: |
9/3/2002
TIME EXPIRED
|
|
|
|
Description:
Expression Evaluation using Stacks First, get the file expr.txt that will serve as your input. This is a file with each line being an integer algebraic expression that you will evaluate. Print each expression and its value, one per line. Setup an ADT Stack type (based on a linked list) so you can have a stack of integers whenever you need one. The expressions consist of integer constants and operators +, -, *, /, ( and ). Multiplication and division are to have higher precedence than addition and subtraction. Generally, a stack is used in this process. There are 2 main steps in evaluating an expression. First, you need to translate the expression from infix to postfix. For example, a * (b + c) is an infix expression whose postfix equivalent is a b c + *. Computers like postfix expressions because they are VERY easy to evaluate (which is your second step). To evaluate a postfix expression, setup a stack of ints and scan the string from left to right. Push any data value onto the stack. When you see an operator, apply it to the top 2 stack values, pushing the result back onto the stack. At the end, the top of the stack will be the value of the whole expression. First, however you need to translate infix to postfix. A stack is used here as well. Here is the algorithm: Scan the infix string from left to right. When you see a digit, collect any more adjacent digits into one integer value and simply place that value directly into the postfix string you are building. Other non-blank characters are handled as follows: (Let c = the character in question): if c is + - * / or ) then while stack is not empty and precedence(c) <= precedence(TOS) pop the stack add the popped value to the end of the postfix string if not ( end while if c is not ) then push c onto stack else if stack is not empty, pop it end if if c is (, just push it. After you are done scanning the infix string, you need to pop remaining operators off the stack, as with while stack not empty pop the stack add the popped value to the end of the postfix string if not ( end while The 'precedence' function is just an int returning function that you write. It takes a char c input parameter and bascially returns 1 if C is + or -, 2 if c is * or / and 0 if c is anything else.
Deliverables: Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Complete copyrights to all work purchased.
Platform:
Please write this program in C++, I use the Visual C++ 6.0 to compile and run it.
Must be 100% finished and received by buyer on:
Sep 3, 2002 EDT
Deadline legal notes: All times are expressed in the time zone of the site EDT (UT - 5). If the buyer omitted a time, then the deadline is 11:59:59 PM EDT on the indicated date.
Special Conditions / Other:
please deliver the codes ontime
Additional Files:
This bid request includes IMPORTANT additional attached files. Please download and read fully before bidding.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$20 (USD)
|
Aug 31, 2002 12:42:49 PM EDT
|
8.2
(Very Good)
|
|
|
Hello Seatiger74, I have done several academic assignments like this.So i may please be given a chance.I will finish the work to your full satisfaction.
You have given chance to so many coders.So i eagerly expect that you would give me a chance too to prove my caliber.
Regards, V.Lakshmi Narasimhan
|
|
|
|
|
|