Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,174,083 members, 7,890,586 topics. Date: Monday, 15 July 2024 at 04:22 PM

Algorithms - How To Get Better At Solving Dynamic Programming Problems - Soltesh - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Algorithms - How To Get Better At Solving Dynamic Programming Problems - Soltesh (1040 Views)

Google Algorithms To Optimize SEO. / closed / Dynamic Web Design Tutorials Ft Javascript,Ajax,DOM,PHP,MySQL... (2) (3) (4)

(1) (Reply)

Algorithms - How To Get Better At Solving Dynamic Programming Problems - Soltesh by soltesh(m): 12:07pm On Jun 20, 2012
I recently came across this question: "You are given a boolean expression consisting of a string of the symbols 'true', 'false', 'and', 'or', and 'xor'. Count the number of ways to parenthesize the expression such that it will evaluate to true. For example, there are two ways to parenthesize 'true and false xor true' such that it evaluates to true."

I knew it is a dynamic programming problem so i tried to come up with a solution on my own which is as follows. Suppose we have a expression as A.B.C.....D where '.' represents any of the operations and, or, xor and the capital letters represent true or false. Lets say the number of ways for this expression of size K to produce a true is N. when a new boolean value E is added to this expression there are 2 ways to parenthesize this new expression 1. ((A.B.C.....D).E) ie. with all possible parenthesizations of A.B.C.....D we add E at the end. 2. (A.B.C.(D.E)) ie. evaluate D.E first and then find the number of ways this expression of size K can produce true.....................

share your own ideasrolleyes)::
http://www.excel-projects.com

(1) (Reply)

Trendysturvs Blog - New Entertainment Blog / Who Is A PHP Programmer? / Free E-course On Online Business: LINK FIXED!!!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 6
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.