Drawing and finding the value of postfix expression

In summary, the conversation discusses the ending of a problem with no operator and the resulting nodes of 1000 and 160. The speaker also confirms the correctness of their drawn Binary Tree.
  • #1
yakin
42
0
View attachment 2472
View attachment 2473

I am ending with no operator in the end. So 1000 160 would be the answer or what. I do not know what to do from here. Please help!
 

Attachments

  • Capture.JPG
    Capture.JPG
    11.5 KB · Views: 87
  • 20140511_213927.jpg
    20140511_213927.jpg
    53.3 KB · Views: 88
Physics news on Phys.org
  • #2
yakin said:
https://www.physicsforums.com/attachments/2472
https://www.physicsforums.com/attachments/2473

I am ending with no operator in the end. So 1000 160 would be the answer or what. I do not know what to do from here. Please help!
Yes you end up short one operator, so you have nodes containing 1000 and 160 with no operator to join them.
 
  • #3
DavidCampen said:
Yes you end up short one operator, so you have nodes containing 1000 and 160 with no operator to join them.
So 1000 and 160 is the answer. And did I draw the Binary Tree right?
 
  • #4
yakin said:
So 1000 and 160 is the answer. And did I draw the Binary Tree right?

Yes and yes.
 
  • #5


I am not an expert in mathematics or computer science, but I can offer some suggestions based on my knowledge and experience. A postfix expression is a mathematical notation in which the operator is placed after the operands. In this case, the given expression "1000 160" does not contain an operator, so it cannot be evaluated as a postfix expression. It is possible that there is a missing operator or that the expression is incomplete. I would recommend checking the context of the problem and consulting with a mathematics or computer science expert for further assistance.
 

FAQ: Drawing and finding the value of postfix expression

What is a postfix expression?

A postfix expression is a mathematical expression in which the operators are placed after the operands. For example, the expression "3 + 4" in infix notation would be written as "3 4 +" in postfix notation.

How do you evaluate a postfix expression?

To evaluate a postfix expression, you start from the left and read the expression one token at a time. If the token is a number, push it onto a stack. If the token is an operator, pop the top two numbers from the stack, perform the operation, and push the result back onto the stack. Repeat this process until there are no more tokens left. The final result will be the value of the postfix expression.

What are some common operators used in postfix expressions?

Some common operators used in postfix expressions include addition (+), subtraction (-), multiplication (*), division (/), and exponentiation (^). Other operators such as parentheses and modulus (%) may also be used.

Are there any advantages to using postfix notation?

Yes, there are a few advantages to using postfix notation. One advantage is that it eliminates the need for parentheses, making expressions easier to read and evaluate. Additionally, postfix notation is easier to implement in computer programs as it follows a simple rule-based algorithm.

Can postfix expressions be converted back to infix notation?

Yes, postfix expressions can be converted back to infix notation using a process called infix to postfix conversion. This involves reversing the steps for evaluating a postfix expression and using a stack to keep track of the operands and operators. However, the resulting infix expression may not be the same as the original one due to the elimination of parentheses.

Similar threads

Replies
5
Views
2K
Replies
16
Views
1K
Replies
18
Views
3K
Replies
6
Views
2K
Replies
8
Views
2K
Replies
7
Views
2K
Back
Top