Questions tagged [infix-notation]

Operators are written infix-style when they are placed between the operands they act on (e.g. 2 + 2).

Operators are written infix-style when they are placed between the operands they act on (e.g. 2 + 2).

There are a few ways to convert infix to postfix, AKA reverse polish notation.

When working with a recursive descent parser one can factor the grammar.

One can also implement the shunting yard algorithm by Edsger Dijkstra which can be refined into precedence climbing.

540 questions
-2
votes
1 answer

Evaluate Post order expression

What will be the resulted value of 7 4 3 + - 3 9 2 / + * 2 ^ 5 * It is in post order. So how can I get the value of this expression?
Iqbal
  • 235
  • 8
  • 20
-3
votes
1 answer

Postfix to Infix conversion in C++. "Process returned -1073740940 (0xC0000374) execution time : 5.538 s". No clue why

The question is to convert a postfix expression to an infix expression using stacks and without stack library. Im getting a statement after i run it and enter my postfix expression saying : "Process returned -1073740940 (0xC0000374) execution time…
-3
votes
1 answer

postfix evaluation using queues and stacks c++

main code Associated files will be linked to…
-3
votes
2 answers

Evaluate infix string expression consisting of only addition and multiplication

How can I evaluate an infix string expression which only consists of + and * operators. (No parenthesis). Example 1: Input: "1+2*3" Output: 7 Example 2: Input: "1+2*3+4" Output: 11 Here is my code I have so far (which is not giving correct…
A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
-3
votes
1 answer

Shunting-yard algorithm with function support

i found this implementation of the Shunting-yard algorithm over the internet (Infix to Postfix with function support) infix_to_postfix(infix): postfix = [] infix.add(')') stack = [] stack.push('(') for each token in infix: if token is operand: …
Error_404
  • 109
  • 7
-3
votes
1 answer

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 is ++ or ** or / or -- because it checks from left,…
how
  • 3
  • 4
-3
votes
1 answer

Infix to prefix works but not for power (caret) function expressions?

I have a function that's taking infix expressions and converting them to prefix expressions. Here's my code: string infixToPrefix(string expression) { stack S; //holds operators stackoutput; //display like in class string…
Riles
  • 34
  • 4
-3
votes
1 answer

The pop function in my Stack return strange characters - C++

I'm having serious issues with my Stack and String functions in C++. I already coded my String and was fully working but now I don't know what to do. My Stack too, I already used my Stack class with integers, but when I tried to use with my…
FIM
  • 33
  • 4
-3
votes
2 answers

Output shows un common characters while changing from infix to postfix notation using C++

Input: 3 (a+(b*c)) ((a+b)*(z+x)) ((a+t)*((b+(a+c))^(c+d))) Output: abc*+ ab+zx+* at+bac++cd+^* There are brackets in all the inputs, so precedence order of operators need not be checked. The following is my solution: #include #include…
aste123
  • 1,223
  • 4
  • 20
  • 40
-3
votes
4 answers

How to check for matching parentheses in Java?

For my homework assignment, we are supposed to use stacks to make a calculator using infix and postfix in java. While I am reading in the equations from the file, there are lots of parentheses. I am supposed to make sure they match up and have an…
Shark Surfer
  • 67
  • 1
  • 6
-4
votes
1 answer

How to convert infix equation to postfix equation on C#?

I found so much algorithms on google but, I can't find runnable algorithm that convert infix to postfix. How to convert infix equation to postfix equation on C#? Please help...
sumin Lee
  • 3
  • 1
-4
votes
1 answer

Breaking out of a while loop in Java

I'm trying to finish an assignment right now. I have a 'calculator' without parentheses, that converts this infix expression to postfix, and is trying to handle the situation of where there are operators in the operator stack. I am referring to this…
-6
votes
2 answers

Not able to figure out the logical error in my code

There is some logical error in my code but I'm not able to figure out what it is. When I run my code it doesn't give me desired results. OUTPUT: Enter an infix expression 2+3 2 I get 2 as my postfix expression whereas I should be getting…
hrvtech
  • 3
  • 3
-6
votes
1 answer

How to calculate how many times a string appears in another string?

I need to find out for example how many times test appears in ttest and answer for that would be 2, or for example world in w1o1r1l1d and answer would be one. I have already written a code which finds all possibilities, and then checks if it is the…
Luka
  • 187
  • 3
  • 9
1 2 3
35
36