No, this is not correct. The answer should be "Infix to Postfix: a*b/c+d/e/f

  • Context: MHB 
  • Thread starter Thread starter needOfHelpCMath
  • Start date Start date
Click For Summary
SUMMARY

The correct postfix expression for the infix notation "a*b/c+d/e/f" is "ab*c/de/f/+". This conclusion is based on the evaluation of operators with the same priority, specifically multiplication (*) and division (/), which are processed from left to right. The expression is structured as ((a*b)/c)+((d/e)/f), ensuring accurate conversion to postfix notation.

PREREQUISITES
  • Understanding of infix and postfix notation
  • Knowledge of operator precedence and associativity
  • Familiarity with mathematical expressions and their evaluation
  • Basic skills in algorithm design for expression conversion
NEXT STEPS
  • Study the Shunting Yard algorithm for converting infix to postfix notation
  • Learn about operator precedence rules in programming languages
  • Explore stack data structures for managing operator evaluation
  • Practice converting various infix expressions to postfix format
USEFUL FOR

Students learning about data structures, computer science enthusiasts, and anyone interested in understanding expression evaluation and conversion techniques.

needOfHelpCMath
Messages
70
Reaction score
0
Code:
Here is my problem a*b/c+d/e/f:
*there is no code because professor ask me do hand write it out*

My answer: abc*/def//+is this correct?
 
Technology news on Phys.org
needOfHelpCMath said:
Code:
Here is my problem a*b/c+d/e/f:
*there is no code because professor ask me do hand write it out*

My answer: abc*/def//+is this correct?

Hi needOfHelpCMath! (Smile)

It should be: [M]ab*c/de/f/+[/M]

That's because * and / have the same priority and are evaluated left to right.
So the expression is evaluated as [M]((a*b)/c)+((d/e)/f)[/M].
The postfix expression reflects that.
 
I like Serena said:
Hi needOfHelpCMath! (Smile)

It should be: [M]ab*c/de/f/+[/M]

That's because * and / have the same priority and are evaluated left to right.
So the expression is evaluated as [M]((a*b)/c)+((d/e)/f)[/M].
The postfix expression reflects that.

thank you very much clarifies my mistakes!
 

Similar threads

Replies
9
Views
3K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 0 ·
Replies
0
Views
2K