what is an easy but efficient way to evaluate Boolean Expression. I have been searching a lot in google but not really finding a good book or site which has working algorithm.

Input string (A=100) and B > 4) Expected output to be either True or false.

regards Deb

  • 1
    $\begingroup$ You need to 1) parse the boolean expression and 2) compute its semantics. Any good university course about compilers and programming languages should explain this in some detail. You'll probably find notes/videos around the net (e.g. coursera). $\endgroup$ – chi Nov 16 '16 at 17:50
  • $\begingroup$ Asking the same question again is not a good thing, and is not likely to produce a different result. Instead, try to improve it, by telling us where did you get stuck, and/or what didn't you understand in the material you were given. $\endgroup$ – André Souza Lemos Nov 16 '16 at 20:32
  • $\begingroup$ I need a book where official algorithm is written with example including all steps. Most google searches are coming up with not complete document. $\endgroup$ – deb Nov 16 '16 at 21:20
  • $\begingroup$ There is no "official algorithm" for something like this because there is no governing body over expression evaluation. There are many variants on this. A SQL server may implement this in a way that permits efficient table access. A LISP engine may implement it in a way which permits memorization. An introductory textbook may implement it with few operations. A C++ compiler course will include order of operations. The list goes on and on. $\endgroup$ – Cort Ammon Nov 17 '16 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.