# Questions tagged [postfix-notation]

Postfix notation (also known as Reverse Polish Notation, RPN) is a mathematical notation wherein every operator follows all of its operands, in contrast to Polish notation, which puts the operator in the prefix position.

**0**

votes

**1**answer

10 views

### Does ALU know about postfix notation?

*AS we all know that alu perform Arithmetic operation but does computer understand post-fix notation or not?
*

**0**

votes

**0**answers

20 views

### Problems in converting Infix to Postfix using stacks and queues in java

It works if the equation contains any variant of NUM +/-/*// NUM.
However adding more operators will cause it to not work, and brackets will cause an infinite loop. I was hoping someone could tell me ...

**0**

votes

**0**answers

57 views

### Trying to convert infix to postfix returns backwards output

I am creating a Reverse Polish Notation calculator that converts an infix expression to a postfix expression. However, my operators are outputting backwards. For example, I have entered the infix as "...

**2**

votes

**1**answer

120 views

### Testing for too many operands on C++ postfix to infix stack

I'm currently trying to test for if there are too many operands but cannot figure out the condition for when a postfix expression has too many operands.
Could someone give me any pointers on what to ...

**-1**

votes

**1**answer

46 views

### writing infix to postfix, cannot tell why my code is throwing an out of bounds exception

I am trying to do this without using java's built in stack, so i made a class with functions (listed below). I cannot figure out for the life of me where my mistake in logic causes the error.
package ...

**-3**

votes

**0**answers

16 views

### Why do you think Dijkstra offered an algorithm from converting from infix to postfix notation even after computer support postfix notation?

Why do you think Dijkstra offered an algorithm (Shunting yard) from converting from infix to postfix notation even after computer support postfix notation?

**0**

votes

**0**answers

25 views

### Error in infix to postfix conversions using stack [duplicate]

I am performing an infix expression to postfix expression conversion using a stack.
However, the following errors occur upon execution:
Exception in thread "main" java.lang.NullPointerException
...

**0**

votes

**7**answers

56 views

### How to take the sum when '+' is present?

I'm working with post-fix notation and stacks, and I'm wondering if/how I can sum the elements of a list, stack etc. when the string '+' is present?
For the example, I'm just going to use a list ...

**0**

votes

**2**answers

54 views

### Catching a missing operand or operator in stack while converting to postfix from infix

I have been attempting to figure out how to be able to catch a missing operand or operator while converting from infix to postfix.
e.g.)
Tall = Y
would print out
Tall Y =
I thought about ...

**0**

votes

**0**answers

30 views

### Problem with the result on the top of stack

I had a calculation problem and I could not figure out where the issue is. It must pop the last 2 numbers added to the stack and the pop the last operator with higher precedence from the stack and ...

**1**

vote

**1**answer

63 views

### Trying to understand the Shunting Yard Algorithm

I am trying to do the Shunting-yard algorithm so I started researching about it. While doing so, I found some interesting documentation which I do not really understand:
// Current token is a ...

**9**

votes

**2**answers

409 views

### Generating all possible “unique” RPN (Reverse Polish notation) expressions

I want to generate in Python all possible RPN (Reverse Polish notation) expressions, that use letters from an input list (such as ['a', 'b', 'c']) and contain operators ['+', '-', '*', '/'].
My idea ...

**1**

vote

**1**answer

42 views

### How to properly write evaluatePostfix function?

I'm new to coding. Trying to write an evaluatePostfix function in Java.
I keep getting an error:
incompatible types: int cannot be converted to Character
stack....

**0**

votes

**0**answers

30 views

### Mail is forward to another mail id but not stored in sender inbox in postfix server

I am using custom domain in postfix server.
in Virtual-regex file i write the below code
/.+@.+/ /.+@.+/ notifications@xxx.com
recipients is custom@yyy.com
when i send a mail to custom@yyy.com it ...

**-1**

votes

**2**answers

53 views

### Infix to Postfix notation not respecting second set of parentheses

Having trouble getting the correct outcome of
Infix: (A+B)/(C-D) Postfix: AB+CD-/
I keep getting Postfix: AB+C/D-
I do know that the issue is coming from it not being able to pop the last ...

**-2**

votes

**1**answer

280 views

### C++ Infix to Postfix Conversion and Calculator

I'm new to stackoverflow, and have final project for my Data Structures class in college. For my project, I am creating a calculator that takes a mathematical expression from input, such as (11-2)/3*(...

**2**

votes

**1**answer

143 views

### haskell reverse polish notation

being new to haskell I decied to try and implement a mini reverse polish notation function:
Takes in a list of type int and a string operator ('*','+','/','-')
apply the operator to the tail ...

**0**

votes

**0**answers

30 views

### add postfix in <input> of php

I wanted to add a currency postfix into the input slider using this code:
if($service_finder_options['search-price']) {
$html .='
<div class="col-md-6 col-sm-6">
&...

**1**

vote

**1**answer

20 views

### Trouble with regex patterns for UNSIGNED_DOUBLE

I have trouble with compiling a code that converts an infix expression to a postfix expression. I suspect the following two lines of code to be giving me the issue:
public static final Pattern ...

**0**

votes

**0**answers

29 views

### How to make a (TABLE) of converting infix to postfix in Python?

I can't find any solution to change my output into a table in Python. Can someone help? Thanks.
I've try search for Python Lists Modul, but it doesn't help.
I didn't find any suggestion to input the ...

**0**

votes

**0**answers

31 views

### Converting infix to postfix

I am trying to convert some data from infix to posfix but the problem that I am having is that the supposedly converted postfix is not printing anything. This is what i have
public static void main (...

**-6**

votes

**1**answer

63 views

### program using Scheme that evaluates a postfix expression [closed]

I want to convert a postfix expression using scheme
The expression will be given to the interpreter as a list of operands and operators such as display( postfix(30 8 7 + / 3 4 - *) )
This example ...

**0**

votes

**0**answers

15 views

### Need to develop a spreadsheet processor that takes a CSV representing a saved spreadsheet as input

help me develop a spreadsheet processor that takes a CSV representing a saved spreadsheet as input, evaluates the cells and outputs a CSV of the cells of the sheet as with all formulas executed ie how ...

**0**

votes

**1**answer

82 views

### Python prefix postfix infix, no parentheses

I came to Python from Mathematica. Are there prefix, postfix, and infix operators without parentheses like in Mathematica in Python?
e.g. In Mathematica
Print@@string
string~Join~string
data//Sum
I ...

**0**

votes

**1**answer

13 views

### how to handle back to back characters in postfix notation

how do you account for two characters back to back while using a stack and postfix notation? I have converted my postfix equation to a string and then trying to account if it is a character or a ...

**0**

votes

**1**answer

52 views

### I'm trying to change infix to postfix in java, what is the problem?

I want to convert infix to postfix with stack data structure.
In this code, I didn't consider the case of * and /.
example input: 10 - ( 3 + 4 ) - 1
correct output is: 10 3 4 + - 1 -
but my ...

**1**

vote

**1**answer

64 views

### Issue converting char to int java

I am writing a code that takes a infix expression and converts it to postfix. It then takes the postfix expression and solves it. Converting from infix to postfix works fine, but for some reason my ...

**0**

votes

**1**answer

27 views

### Postfix Expression Evaluator, pop method errors

I'm trying to take an expression from the user and evaluate it but I keep getting pop method errors that are leading to arrayindexoutofboundsexceptions and null pointer exceptions. How do I fix this, ...

**0**

votes

**1**answer

19 views

### EmptyStackException in Postfix notation

When I try to run my postfix expressions I am getting an EmptyStackException due to the fact that my string has two operands back to back. I cannot figure out how to capture this within my stack. ...

**0**

votes

**0**answers

32 views

### Function not outputting into main

This is for school
I was assigned to convert an expression from infix into postfix and evaluate the expression. I know this isn't the most efficient way to do this problem but I have two separate ...

**0**

votes

**2**answers

49 views

### Operators are misplaced in the output of postfix notation of an infix expression given as a String

Here is a Java code that takes as an input infix expression string with multiple levels of braces and mixing operands and outputs as one long postfix expression.
I converted the infix notation String ...

**1**

vote

**2**answers

198 views

### JAVA Evaluating postfix expressions — unable to throw empty or invalid expressions

I'm writing a program that will evaluate a postfix expression and print both the original expression and the result. But I want to account for the validity of the expression as well. For this, I've ...

**0**

votes

**1**answer

53 views

### infix to postfix runtime error in c

This is the code i have written to convert an infix expression to postfix expression without using structures in c language.But sometimes its giving unexpected output and sometimes its displaying "...

**-1**

votes

**3**answers

61 views

### How do I turn the multiple-line form of conditions to postfix form?

This is a multiple-line form of conditional statement:
if button_down?(@buttons[:forward]) and @speed < @max_speed
@speed += @acceleration
elsif button_down?(@buttons[:backward]) and @speed >...

**0**

votes

**1**answer

54 views

### infix postfix conversion c++, can't seem to get the right answer

so I've working on an assignment converting infix format to postfix format using a stack for the operators, for the digits of the infix notation, the code worked fine, but for the operators, it doesn'...

**1**

vote

**3**answers

116 views

### What is this unary postfix in dart/flutter?

i saw this unary postfix in Dart/flutter code: ?.
like this:
videoController?.dispose();
and i want to know how it work...

**0**

votes

**2**answers

45 views

### Comparing rpn (postfix) expressions for equivalency

How would one compare any two postfix notated expressions for equivalency?
In the simplest example, foo(a, b) returns True for
a = [3, 5, 'MUL']
b = [5, 3, 'MUL']
What would foo() look like in ...

**0**

votes

**2**answers

69 views

### c++ postfix evaluation problems

stack<int> s;
int main() {
string exp;
cout << "Enter postfix expression: ";
getline(cin, exp);
int calc = evaluatePosfix(exp);
cout << calc << endl;
}
int ...

**-1**

votes

**1**answer

53 views

### implementing a infixToPostfix method, but don't know why do I push '(' at first time

I didn't implement whole infixTopostFix method yet.
but I have a question about it.
I am figuring out it still.
(notice: My infixToPostfix method is not complete yet)
#include <stdio.h>
#...

**0**

votes

**1**answer

197 views

### RPn handle negative number division

Currently, I am making a calculator inputing mathematical expression and use RPn to calculate it. Therefore, I use a infix to postfix converter function to convert it. The calculator works by pushing ...

**-3**

votes

**1**answer

150 views

### Reverse Polish notation Calculator

I am currently working on a RPN calculator, it takes an infix expression converts it to postfix and shows the answer. I mostly got it right, but when I pop the answer from the stack if shows only the ...

**1**

vote

**0**answers

86 views

### Return if an expression is invalid or its output in C++

I have a postfix expression and I need to evaluate it also check for its validity. There can be a way in which I first evaluate the expression and if it is valid then I go for its calculation But that ...

**0**

votes

**1**answer

46 views

### infix to postfix expressrion not showing any output

infix to posfix expresion where a+b is converted in ab+.
i have been staring at the code for hours and wondering why is not showing any output at all. i tried reviewing it by line to the best that i ...

**0**

votes

**1**answer

24 views

### Found a bug, fixed it , I dont understand why it was bugging?

I've come across a bug that has now been fixed but I still dont understand the underlying cause for it.
What I would like to do:
Use post-order tree traversal to get postfix expression from a binary ...

**-3**

votes

**1**answer

259 views

### String must be exactly one character long error

I want to make a postfix calculator.
Stack yigin1 = new Stack();
So i created a input area with
string inp = Console.ReadLine();
and parsed with Split() method
string[] words = inp.Split(' ');
...

**0**

votes

**2**answers

135 views

### How to evaluate a postfix expression using character stack using ASCII conversions

The code is implemented using ADT by including the "stack.h" user defined header file.
The header file has code for stack operation.
I am getting the outputs as weird symbols because of improper ...

**0**

votes

**0**answers

56 views

### Infix to Postfix function using stacks, but without using peek method

so i wrote a function to convert from infix to postfix. It works for most inputs, but gives a null pointer exception if i try to convert any string that has two open parenthesis back to back (ex: 2*((...

**-1**

votes

**2**answers

268 views

### Python Postfix Notation Stack Class

I am having to write a Stack class that uses postfix notation for calculating problems entered from a text file using Python. I am also suppose to update the list and not allow there to be more than ...

**0**

votes

**1**answer

164 views

### Postfix evaluation method in Java

So I tried writing a code for postfix evaluation method and it is giving me the most outrageous results.
the post fix expression I entered was "92*3+4-" and by my calculation the answer should be 17. ...

**0**

votes

**0**answers

46 views

### How to verify a mathematical expression? [duplicate]

I'm writing a scientific calculator, and am currently on the stage of tokenising the infix string. I've also implemented a working Dijkstra's Method (I think this is also known as the Shunting-Yard ...