Skip to main content
Filter by
Sorted by
Tagged with
2 votes
0 answers
160 views

I am working with a situation in which I need to turn an arithmetic string expression (e.g. (3/2) * (3**4 / (20 * 4))**(-1/4)) into the following prime factorization form: $\prod_{p:\text{prime}}p_i^{...
F. X. P.'s user avatar
  • 145
-1 votes
2 answers
259 views

I am attempting to write up the following algorithm (provided in ordinary English) in Python for converting simple mathematical expressions from infix form to postfix form: Create a new empty list, '...
user829347's user avatar
1 vote
1 answer
135 views

I'm working on a problem in my data structures class and I've managed to do most it in terms of implementing the algorithm and getting the core logic sorted. But one problem that I keep running into ...
ATR2400's user avatar
  • 41
1 vote
1 answer
45 views

This is what I have so far, this is a continutation of some pythoncode my classmate wrote and we keep getting lots of errors. I think the errors lie somewhere in the if and for loop but I am fairly ...
wb2026's user avatar
  • 11
1 vote
1 answer
556 views

I am trying to convert a given infix expression to prefix expression in c. But i am encountering a problem in it. The value in postfix is not getting updated. Please help me understand what the issue ...
Dhairya Gupta's user avatar
1 vote
0 answers
106 views

First of all, I started learning Ruby only 2 weeks ago, so please do not judge too harshly. I wrote a script that does not work correctly with mathematical expressions containing parentheses. The ...
dennyk's user avatar
  • 11
1 vote
2 answers
109 views

I'm having issues with my PEMDAS calculator built in python. The issue that I'm encountering is mainly that I can't find a way to make my code recognize the "-" sign at the beginning of the ...
Mave360's user avatar
  • 15
1 vote
1 answer
181 views

I am having a problem converting from postfix to infix in C. I know where the problem is, but I don't know how to fix it. #include <stdlib.h> #include <string.h> #include <ctype.h> ...
Alaa Zaabat's user avatar
0 votes
1 answer
193 views

I need to implement an expression evaluator with some custom types, it is easy to evaluate expressions with only numbers or variables with the help of postfix (or prefix) notation but how to extend ...
srilakshmikanthanp's user avatar
-1 votes
1 answer
59 views

If I push a character to the Stack and peek at it, it gives me different characters even when no interaction was made after the push. The relevant class and functions look like this: class Stack: ...
Sanghyun Na's user avatar
1 vote
0 answers
39 views

I was solving a question where the task is to evaluate the postfix expression and find the final value. this is my solution code public static int evaluatePostFix(String S) Stack<Integer> s = ...
jjp's user avatar
  • 35
0 votes
0 answers
97 views

I've been stuck on this program for about a week and I can't see what I'm doing wrong. I can't get the operands and operators to print in the proper spot and the '(' ')' won't delete. Here's what I ...
Tiara Grier's user avatar
0 votes
2 answers
98 views

I’m writing calculator that calculates values ​​from expressions: 3+(23/24)*34/24 I used RPN algorithm: https://en.wikipedia.org/wiki/Reverse_Polish_notation I have now sorted expression in String: ...
Tomasz Okraszewski's user avatar
0 votes
1 answer
113 views

I'm trying to implement postfix evaluation using stack, but the result after calculation is not correct, I cannot figure out which part makes the calculation wrong, thanks a lot. import java.util....
ian's user avatar
  • 55
-1 votes
1 answer
770 views

I am writing a program where the user inputs a postfix expression and it outputs the answer. Current I am stuck when Using my 'evaluate' function within my for loop. Inside my For loop Main.py: else: ...
Corey Rinda's user avatar
-1 votes
1 answer
229 views

I need to define the semantic actions required to translate infix notation to postfix notation by embedding semantic actions as Java code in the g4 grammar file. For example, when I try to input "...
bam's user avatar
  • 3
-2 votes
1 answer
64 views

#include <stdio.h> char infix[200]; char stack[200]; char queue[200]; int count_stack = 0; int count_queue = 0; int precedence(char x) { switch (x) { case '^': return 2; ...
Geek's user avatar
  • 91
0 votes
0 answers
139 views

My problem is that my evaluatePostfix() function is not calculating operands. It only returns the top of the stack in the converted postfix expression. So for example, my output is: Enter a infix ...
evantuazon's user avatar
-1 votes
1 answer
620 views

#include<bits/stdc++.h> using namespace std; int prec(char c){ if(c=='^'){ return 3; }else if(c=='*' || c=='/'){ return 2; }else if(c=='+' || c=='-'){ return ...
Devansh Garg's user avatar
1 vote
1 answer
388 views

#include<stdio.h> #include<string.h> #include<stdlib.h> int n; int stackfull(int top) { if(top==n) { return 1; } else { return 0; } } int ...
Ashutosh Deshmukh's user avatar
0 votes
2 answers
481 views

For a research project, we are currently using the Gamblers Ruin Algorithm to produce random postfix expressions (terms) using term variables "x", "y", and "z" and an ...
Nick Falco's user avatar
1 vote
0 answers
212 views

I am making a Python program where I get an RPN expression separated by spaces and convert it to infix. It should work like this: Input RPN: x 2 ^ 3 - 1 2 x * - * Output : -2x^3 + x^2 + 6x - 3 However,...
Lashen's user avatar
  • 434
0 votes
1 answer
91 views

Here is my code about postfix in scheme: (define (stackupdate e s) (if (number? e) (cons e s) (cons (eval '(e (car s) (cadr s))) (cddr s)))) (define (postfixhelper lst s) (if (null? lst) ...
user avatar
0 votes
0 answers
77 views

Here is the code(Helped with https://stackoverflow.com/a/73017526/19567940) : (define (update-s object stack) (if (number? object) (cons object stack) (cons ((eval object (scheme-report-...
user avatar
0 votes
1 answer
212 views

Does anyone can help me to deal with the problem? I tried for many times, but it still has the error information. This is my code(scheme) Thanks!!! (define (postfix l s) (cond( ((null? l)(...
user avatar
1 vote
1 answer
289 views

I was trying to make a calculator for my university homework. to calculate the results I use infix to postfix convention. but this code doesn't take only decimal point (.) as a result, it crashes ...
c.dipu0's user avatar
  • 103
1 vote
0 answers
402 views

What would be a good algorithm to convert infix to postfix of an expression which uses user-defined functions: For example: def get_random_integer(a, b, c): import random return random.choice([...
visuman's user avatar
  • 140
0 votes
1 answer
170 views

It works for all the test cases as long as the input string has "()" in it. If I input let's say (2+3) or even 2+3) it will print my the correct solution which is 23+. But if I input 2+3 ...
Parv's user avatar
  • 13
-3 votes
1 answer
301 views

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 : "...
Aryan Raveshia's user avatar
-1 votes
2 answers
126 views

I have been trying to implement the shunting yard algorithm, but the output of my parser is incorrect. let mut stack: Vec<String> = vec![]; let mut op_stack: Vec<String> = vec![]; for ...
Ashtyn's user avatar
  • 29
1 vote
1 answer
232 views

below is the code of infix to postfix conversion using stack.The code executes an infinite loop printing stack underflow in one of the pop function ,i have tried commenting pop function call in right ...
SWAPNIL SRIVASTAVA's user avatar
0 votes
0 answers
126 views

I try to implement a RPN (postfix) calculator but a requirement for this is use the MAX operator such in the following examples input: 5 2 "MAX" 2 1 "MAX" "*" output: 10 ...
piratax007's user avatar
0 votes
1 answer
198 views

My recursive function accepts a String prefix and an int index of this string (0 initially). Depending on the index calculates a postfix string. Storage is a class that holds the postfix string and ...
Jaren Arbanas's user avatar
1 vote
0 answers
342 views

We are supposed to write a program using the stack class that converts a string from infix to postfix using JOptionPane as the input method. We are supposed to do it all in one big for loop and one ...
John Silver's user avatar
0 votes
0 answers
42 views

When I tried making if condition to while loop to remove more than one operator from stack in bracket (f+g/h) here output should be (fgh/+) but i am not able to run the code with while loop my output ...
Yash_3001's user avatar
0 votes
1 answer
1k views

I wrote this code to evaluate postfix expressions, but in this code I can only evaluate an expression with only single-digit numbers. I want to edit this code for it to evaluate multi-digit numbers. ...
mahmoud adel's user avatar
4 votes
3 answers
2k views

I'm trying to program a reverse polish calculator and I didn't wanted to write switches for every single arithmetic operator inputted. Is it possible to input an arithmetic operator and use it as such ...
hjhbb's user avatar
  • 51
0 votes
0 answers
47 views

The problematic to resolve: Given a string that contains a mathematical expression, I need a function on C# language that receives that string and returns its decimal result that respects the ...
Decker's user avatar
  • 1
0 votes
1 answer
145 views

-2^2 (infix notation) should translate to -2 2 ^ (postfix notation). It does as expected however when evaluating that postfix it evaluates to 4 not -4 which is what is expected. I'm using Lua and here'...
imp's user avatar
  • 13
0 votes
1 answer
95 views

I am getting error for no operator "==" matches these operands -- operand types are: info == charC/C++(349) I guess this is due to the fact im using couston data type I making program to ...
Agrim Kaundal's user avatar
0 votes
3 answers
570 views

So I implemented this before in JavaScript as a little practice and was sure I found a Wiki page for an algorithm that both converted a typical infix expression to post fix AND calculated the answer ...
RandomUser123's user avatar
0 votes
1 answer
116 views

class Solution: def evalRPN(self, tokens: List[str]) -> int: surya = [] x = 0 y = 0 res = 0 for i in range(len(tokens)): if tokens[i]....
user14365180's user avatar
0 votes
1 answer
282 views

First time here, anyone know what this postfix expression would be in infix? s s * x y z * * sqrt s t - / s t * + Where sqrt is square rooting. My current guess is: (sqrt ((s * s) (x * y * z))) / (s - ...
Lex's user avatar
  • 43
0 votes
2 answers
585 views

I wanted to create a method, that interprets this List (The method "words" splits a String into a list of words, that are seperated by \s.) in postfix-notation. This is what I got, by I am ...
Sentenza_IV's user avatar
-1 votes
1 answer
119 views

I write a read-syntax function but ı get this error. my read-syntax function is this: (define (read-syntax path port) (for([line (port->lines port)]) (parse-line line))) The error is this: ...
hasanaliozkan's user avatar
1 vote
1 answer
16k views

Can anyone help me with Postfix to Infix conversion in C? I know the algorithm, it's something like: Take the expression as input if the char is an operand, then push it into the stack if the char is ...
Animesh Sethi's user avatar
0 votes
0 answers
99 views

I tried making a function which transforms a string in postfix notation to an expression tree. But i cant figure out what is wrong with it. node_t* expressionTree(char *str,stack_t *p2) { int i; ...
Zolak's user avatar
  • 23
-1 votes
1 answer
57 views

This method is part of a class that converts inputs from infix to postfix. An example input would be: "11.897/3.4+9.2-0.4*6.9/12.6-16.7=" I have some helper methods below the main method (...
Yogesh Riyat's user avatar
-1 votes
1 answer
31 views

I am trying to build an algorithm that converts infix to postfix. Here are the sample inputs below. You can see that it is all one string without spaces. Also, the inputs can have floats or integers ...
Yogesh Riyat's user avatar
0 votes
0 answers
82 views

I am trying to write a program to convert infix expression to postfix expression. But I am getting the error Runtime Error: Segmentation Fault (SIGSEGV) I know that SIGSEGV is an error caused by an ...
Biplab Prasad's user avatar

1
2 3 4 5
12