Solution Found!
Let us define a multiplication operation on three symbols a, b, c according to the
Chapter 6, Problem 6.6(choose chapter or problem)
Let us define a multiplication operation on three symbols a, b, c according to the following table;thus ab = b, ba = c, and so on. Notice that the multiplication operation defined by the table isneither associative nor commutative.Find an efficient algorithm that examines a string of these symbols, say bbbbac, and decideswhether or not it is possible to parenthesize the string in such a way that the value of theresulting expression is a. For example, on input bbbbac your algorithm should return yes because((b(bb))(ba))c = a.
Questions & Answers
QUESTION:
Let us define a multiplication operation on three symbols a, b, c according to the following table;thus ab = b, ba = c, and so on. Notice that the multiplication operation defined by the table isneither associative nor commutative.Find an efficient algorithm that examines a string of these symbols, say bbbbac, and decideswhether or not it is possible to parenthesize the string in such a way that the value of theresulting expression is a. For example, on input bbbbac your algorithm should return yes because((b(bb))(ba))c = a.
ANSWER:Step 1 of 3
Dynamic programming is one of the efficient ways to solve the given problem.
Consider, be the string. Let A is set of all possible values of the string S under all the ways of parenthesizing from .
If then the algorithm of the given problem returns “true”,otherwise returns “false”.