in Algorithm Challenges retagged by
1,087 views
0 votes
0 votes
Given an arithmetic expression involving *, + only write an object oriented code for its representation and evaluation
in Algorithm Challenges retagged by
by
1.1k views

9 Comments

evaluation of expression using java ?
0
0
yes, Java is fine. But consider only + and *. Importance is in how well the classes are designed.
0
0
if - or / comes in middle then that expression will not be evaluated with this code?
0
0
Evaluation by stack

1> take an expression

2> Do its postfix

3> Then evaluate by + or *
0
0
Yes, but a bit more formal. First represent the expression in a tree. So, this tree need to be designed- how should be its nodes?
0
0
reshown by
Each internal node corresponds to operator and each leaf node corresponds to operand .rt sir ?
0
0
yes like parse tree
0
0
@Manojk exactly. Now put them in C++/Java classes.
0
0
edited by

sir done here

As I cannot remember some functions of java , I took help from net

It is exactly what u want (if we remove preorder traversal part), rt?

0
0

Please log in or register to answer this question.

Related questions