Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that you are given an unparenthesized mathematical expression containing n numbers, where the only operators are + and , as shown here: 4 +

Suppose that you are given an unparenthesized mathematical expression containing n numbers, where the only operators are + and , as shown here: 4 + 3 2 5 + 1 6 + 7 You can change the value of the expression by adding parentheses in different positions. For example: 4 + 3 2 5 + 1 6 + 7 = 2 (4 + 3 (2 5)) + (1 6) + 7 = 12 (4 + (3 2)) (5 + 1) (6 + 7) = 14 For the purposes of this problem, we'll assume you can only put parentheses immediately before and immediately after a number, so that you couldn't interpret the expression multiplicatively as 4 + 3 (2) (5) + 1 6 + 7 = 36 Design an algorithm that, given an unparenthesized expression using only + and , determines the maximum possible value the expression can take when parentheses are added in. Your algorithm should run in time polynomial in n. Then: Describe your algorithm. Prove that your algorithm finds the maximum possible value the expression can take. Prove that your algorithm runs time polynomial in n.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions