Algorithm for evaluating nested logical expression
- by TravelingSalesman
I have a logical expression that I would like to evaluate.
The expression can be nested and consists of T (True) or F (False) and parenthesis.
The parenthesis "(" means "logical OR".
Two terms TF beside each others (or any other two combinations beside each others), should be ANDED (Logical AND).
For example, the expression:
((TFT)T) = true
I need an algorithm for solving this problem. I thought of converting the expression first to disjunctive or conjunctive normal form and then I can easily evaluate the expression. However, I couldn't find an algorithm that normalizes the expression. Any suggestions? Thank you.
The problem statement can be found here:
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=2&category=378&page=show_problem&problem=2967