Just wanna have it checked if i'm doing this rightly...

i was given an expression to translate it into a polish notation and traversals.

the expression is

{( a + b ) - c } * { d * (e / f + g)}

here's my answer:

POSTFIX : a b + c - d e f g + / * *
PREFIX : * - + a b c * d / e + f g

PRE-ORDER : * - + a c b * d / e + f g
POST-ORDER: a b + c - f g + e / d * *
IN-ORDER : a + b - c * d * e / f + g

No, you aren't.

awww... :(

can you please help me understand this?

Why is your prefix notation and preorder traversal any different?

Why is your prefix notation and preorder traversal any different?

:(

that's how i understood it... :(

should they always be the same?

i'll try it again

pre-order:
* - + a b c * d / e + f g

post-order:
a b + c - f g + e / d * *

in-order:
a + b - c f + g e / d * *

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.