MHB Is this Tree of Algebraic Expression Correct?

  • Thread starter Thread starter Brian82784
  • Start date Start date
  • Tags Tags
    Expression Tree
AI Thread Summary
The discussion focuses on verifying the correctness of two algebraic expression trees derived from the expression ((x - 2) + 3) / ((2 - (3 + y)) x (w - 8)). One participant confirms that the tree on the right is correct, while the left tree incorrectly places w - 8 in the numerator instead of the denominator. Participants discuss preorder, inorder, and postorder search results for both trees, ultimately agreeing that the tree starting with division is accurate. The conversation highlights the importance of correctly representing mathematical operations in tree structures. The final consensus is that the right tree's structure and evaluations are correct.
Brian82784
Messages
19
Reaction score
0
Hello I just wanted to see if I did this right. I've come up with two trees and I'm pretty sure one of them is correct, I'm just not sure.

Construct the Tree of the algebraic expression:
((x - 2) + 3) / ((2 - (3 + y)) x (w - 8))
 

Attachments

  • Tree.jpg
    Tree.jpg
    5.9 KB · Views: 121
  • tree2.jpg
    tree2.jpg
    5.7 KB · Views: 119
Last edited:
Physics news on Phys.org
Kristen said:
Hello I just wanted to see if I did this right. I've come up with two trees and I'm pretty sure one of them is correct, I'm just not sure.

Construct the Tree of the algebraic expression:
((x - 2) + 3) / ((2 - (3 + y)) x (w - 8))

Hi! :) I think that both of them are right,but it would be better to include also the parentheses of the algebraic expression at the trees,that you constructed.
 
Okay thank you. I also had to do this with one of the trees. So I picked the first tree. Does this look correct?

1) Show the results of performing a preorder search.
× ÷ + - X 2 3 - - 2 3 Y - W 82) Show the results of performing an inorder search.
X – 2 + 3 ÷ 2 – 3 – Y × W - 8 3) Show the results of performing a postorder search.
X 2 - 3 + 2 3 - y - ÷ W 8 - ×
 
Kristen said:
Okay thank you. I also had to do this with one of the trees. So I picked the first tree. Does this look correct?

1) Show the results of performing a preorder search.
× ÷ + - X 2 3 - - 2 3 Y - W 82) Show the results of performing an inorder search.
X – 2 + 3 ÷ 2 – 3 – Y × W - 8 3) Show the results of performing a postorder search.
X 2 - 3 + 2 3 - y - ÷ W 8 - ×

I also tried it,and found the same result as yours!It should be right! (Nod) (Yes)
 
The one on the right is correct, the one on the left is incorrect. The one on the left is evaluating the expression $\dfrac{(x-2)+3}{(2-3)-y}(w-8),$ whereas the one on the right is evaluating the expression $\dfrac{(x+2)-3}{(2-(3+y)) \cdot (w-8)}$. You can see that in the left version, $w-8$ is in the numerator, whereas in the right version, $w-8$ is in the denominator.
 
So the one I did starting with Division is actually correct
 
Ackbach said:
The one on the right is correct, the one on the left is incorrect. The one on the left is evaluating the expression $\dfrac{(x-2)+3}{(2-3)-y}(w-8),$ whereas the one on the right is evaluating the expression $\dfrac{(x+2)-3}{(2-(3+y)) \cdot (w-8)}$. You can see that in the left version, $w-8$ is in the numerator, whereas in the right version, $w-8$ is in the denominator.

Oh,yes you are right! Sorry for assuming that the left tree is also right.. (Sadface)
 
Kristen said:
So the one I did starting with Division is actually correct

Right - the "biggest" mathematical operator is the last one you'd evaluate.

By the way, the only reason I can answer this question is that http://mathhelpboards.com/mathematics-software-calculator-discussion-29/hp-50g-1953.html?highlight=calculator, with Reverse Polish Notation (postfix notation) and a stack. That's a very nice combination, because it let's you play with calculations as you go.
 
So then would this be correct for the tree on the right?

1) Show the results of performing a preorder search.
÷ + - X 2 3 × - 2 + 3 Y- W 82) Show the results of performing an inorder search.
X – 2 + 3 ÷ 2 – 3 +Y × W - 8 3) Show the results of performing a postorder search.
X 2 - 3 + 2 3 y +- W 8 - ×÷
 
  • #10
Kristen said:
So then would this be correct for the tree on the right?
Yes, they seem correct.
 

Similar threads

Replies
16
Views
2K
Replies
1
Views
2K
Replies
18
Views
2K
Replies
1
Views
2K
Replies
6
Views
1K
Replies
3
Views
2K
Back
Top