Hi Everyone,
I was wondering, if I can try to solve boolean expression using recurssion in C++. But being a beginner, I am not able to get progress in this. I'll be getting the expression like a string. I have generated a truth table using standard bitwise techniques, but not able to understand how to simplify such complex expressions. eg : (a+(b.c)).(d+e.f)+(g.(t+h)) here, alphabets are boolean var, and + represents bitwise OR , '.' represents bitwise AND. Anyhelp will be appreciated :)
Yes, it is possible. You can create a C++ binary-tree data-structure equivalent to a given Boolean expression f( x1, x2, ...., xn ) in which:
Finally, it should be noted that the binary-tree data-structure can be generalized to a tree data-structure with any number of children nodes according to the logic primitives used the the Boolean expression. For example, a (NOT X) Boolean expression can be represented as a non-leaf node with one child node for (X) only. Another example is the Boolean expression (if X then Y else Z), which can be represented as a non-leaf node with three children nodes (X, Y and Z). Boolean algebra can be applied to simplify the tree without evaluating it for a particular point in the n-dimensional Binary hypercube. It is also possible to restrict the logic primitives used in non-leaf nodes the tree data-structure to 2-input AND and 1-input NOT only, check the following Wiki about AND-Inverter Graph AIG.