After constructing the tree convert the tree to correspond to the associative property of the given expression.
Eg: (1 + 2) * ( 3 + 4) = (1 * 3) + (1 * 4) + (2 * 3) + (2 * 4)
Similar to that, from the constructed expression tree, construct a new expression tree such that inorder traversal of the new tree will be associative value of the given expression
Inorder traversal of the new tree should be (a && c) || (a && d) || (b && c) || (b && d)
Write a generic algorithm to convert the first tree to the second tree..
What is an Expression Tree??
Visit links below.
http://www.brpreiss.com/books/opus5/html/page264.html
http://www.cs.jhu.edu/~goodrich/dsa/05trees/Demo1/
Tree Traversals
Visit the below links for knowing more about tree traversals.
http://en.wikipedia.org/wiki/Tree_traversal
http://www.brpreiss.com/books/opus4/html/page260.html

