c++ - What is a good data structure for processing boolean algebra equations? -
i'm creating program calculate truth values boolean algebra equation. need find data structure able correctly process order of operations of equation involving and, or, not, , parentheses well. equation typed in user.
any type of "order of operation" objects held in trees. this:
- you process textual representation finding highest priority items first
- each simple statement (
true or false
example) put node - you have different types of nodes different operations
- the nodes inserted other nodes, make complex statements
a final tree representation may end looking this:
or ___|__ | | true , ___|___ | | false not | true
that represent statement:
true or (false , not true)
Comments
Post a Comment