0 votes 0 votes Given an arithmetic expression involving *, + only write an object oriented code for its representation and evaluation Algorithm Challenges algorithm-challenge placement-questions + – Arjun asked Jun 6, 2016 retagged May 25, 2021 by Shiva Sagar Rao Arjun 1.1k views answer comment Share Follow See all 9 Comments See all 9 9 Comments reply srestha commented Jun 8, 2016 reply Follow Share evaluation of expression using java ? 0 votes 0 votes Arjun commented Jun 8, 2016 reply Follow Share yes, Java is fine. But consider only + and *. Importance is in how well the classes are designed. 0 votes 0 votes srestha commented Jun 8, 2016 reply Follow Share if - or / comes in middle then that expression will not be evaluated with this code? 0 votes 0 votes srestha commented Jun 9, 2016 reply Follow Share Evaluation by stack 1> take an expression 2> Do its postfix 3> Then evaluate by + or * 0 votes 0 votes Arjun commented Jun 9, 2016 reply Follow Share 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 votes 0 votes ManojK commented Jun 9, 2016 i reshown by srestha Jun 10, 2016 reply Follow Share Each internal node corresponds to operator and each leaf node corresponds to operand .rt sir ? 0 votes 0 votes srestha commented Jun 10, 2016 reply Follow Share yes like parse tree 0 votes 0 votes Arjun commented Jun 10, 2016 reply Follow Share @Manojk exactly. Now put them in C++/Java classes. 0 votes 0 votes srestha commented Jun 10, 2016 i edited by srestha Jun 11, 2016 reply Follow Share 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 votes 0 votes Please log in or register to add a comment.