how can i evaluate an expression using tree

example: 2*6+5/10

actually i have doubt in inserting in a tree.

If you think of sports team's trees, ask yourself:

- which two things have to come first
- then which two things
- then which two things

and so on until you are done. You should end up with a tree!

Since multiplication is before adding, that 2*6 looks like a candidate for the first two things to do. So that is the botom of your tree. Which part of this expression must come next, the / or the +? And go from there.

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.