Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Question Description | ||
|
||
You are given a prefix expression. Write a program to evaluate it. | ||
Input | ||
|
||
The first argument will be an input file with one prefix expression per line. e.g. | ||
|
||
* + 2 3 4 | ||
|
||
Your program has to read this and insert it into any data structure you like. Traverse that data structure and evaluate the prefix expression. Each token is delimited by a whitespace. You may assume that the only valid operators appearing in test data are '+','*' and '/' | ||
|
||
|
||
Output | ||
|
||
Print to stdout, the output of the prefix expression, one per line. e.g. | ||
|
||
20 |