# 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

**0**answers

28 views

### I have a code calculating postfix equations using stack in c but I get some weird interactions

I made a program calculating postfix equations but something is going wrong when entering the while loop and I don't know why.
I tried to see what is going wrong, so I put a printf statement over ...

**-1**

votes

**1**answer

16 views

### confusion about conversion answer infix to postfix

I am trying to learn about Infix to Postfix Conversion from the internet
I have come across 2 sources following which I get different answers to the same infix expression:
a/b^c+d*e/f-g+h
I am ...

**-1**

votes

**1**answer

33 views

### Infix to Postfix with parentheses where 'operands' are not single tokens

I have to write a program that mimics the terminal bash shell where you can put commands together using connectors. An example input would be:
(echo "hello world" && ls -a) || (echo "hello ...

**1**

vote

**0**answers

35 views

### Polish postfix notation not calculating, always showing '0' as result

I'm studying a stack-based polish notation calculator, which reads an infix expression, validates if the parentheses are correct, converts it to postfix and then evaluates it for the end result. But I ...

**2**

votes

**1**answer

30 views

### I need help to convert from infix to postfix in C

I was practising some data structures problems that I did previously but this time I don't know what is going wrong in my code. I looked over a long time but I did not found the mistake. When I'm ...

**2**

votes

**0**answers

46 views

### How to accept negative values in postfix expressions

Similar question has been asked here, However, still remains unanswered (at least no code provided, though the suggestion is good)
My code unlike the hyperlinked one, only evaluates the entered ...

**0**

votes

**0**answers

20 views

### How to modify the postfix() so it can support the use of parentheses

I'm writing a function called calculator(expr) that takes an infix expression, converts it to a postfix expression(by calling postfix()) and then evaluates said expression with the help of the Stack ...

**0**

votes

**0**answers

32 views

### How to add parenthesis to a postfix function?

We need parenthesis for prioritization but not use it as a multiplication. I tried to include the parenthesis but failed to do so. I am also unable to phrase the question properly sorry for that.
def ...

**0**

votes

**0**answers

132 views

### Converting Infix to Postfix Notation and Creating a Binary Tree of the Postfix Representation of the Input in MIPS?

This is a practice programming problem for a Computer Organization class. It is to be done in MIPS Assembly (MARS or QtSpim). I’m quite stuck on what to do here as we have never discussed either ...

**0**

votes

**1**answer

33 views

### Infix to Postfix ' StringIndexOutOfBoundsException' error [duplicate]

I am setting up a method that turn a infix string into a postfix equation with a custom LinkStack.
I have tried to to check if the charAt(i) was null and a if statement to check if i is greater than ...

**0**

votes

**1**answer

46 views

### Need help for conversion of Postfix to Infix using stack

I wrote codes to convert postfix to fully-parenthesized infix as part of my homework but this code only can convert infix expression with single digit numbers. I need help for converting infix ...

**5**

votes

**2**answers

38 views

### Possible Trees using translation scheme for post fix notation of 7-2+3

I was asked to convert 7-2+3 into post fix notation while no operator precedence or left to right or right to left was mentioned in the question and then I had to make tree using translation scheme of ...

**1**

vote

**1**answer

20 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

48 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

63 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

134 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

48 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 ...

**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

57 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

76 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

31 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

66 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 ...

**10**

votes

**2**answers

474 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

47 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

33 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

54 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 ...

**-1**

votes

**1**answer

592 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

175 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

32 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

21 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 ...

**-3**

votes

**1**answer

49 views

### About c++ convert infix to postfix when it contains two power signs (^^)

My goal is to convert infix expression to postfix expression.
I've got a problem with this line:
while(precedence(stack[top])>=precedence(symbol))
Condition is (and should be) satisfied when it ...

**0**

votes

**0**answers

58 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

33 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

88 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

19 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

103 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

14 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

56 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

79 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

29 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

23 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

33 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

51 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

264 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

56 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

62 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

61 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

155 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

46 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

95 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 ...