In this exercise we will develop a dynamic programming algorithm for finding the maximum sum of consecutive terms of a sequence of real numbers. That is, given a sequence of real numbers
a) Show that if all terms of the sequence are nonnegative, this problem is solved by taking the sum of all terms. Then, give an example where the maximum sum of consecutive terms is not the sum of all terms.
b) Let
c) Use part (b) to develop a dynamic programming algorithm for solving this problem.
d) Show each step your algorithm from part (c) uses to find the maximum sum of consecutive terms of the sequence 2, -3, 4, 1, -2, 3.
e) Show that the worst-case complexity in terms of the number of additions and comparisons of your algorithm from part (c) is linear.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
DISCRETE MATHEMATICS LOOSELEAF W/CONNECT
- Question 14 (1 point) Listen The frame on a picture is 18 in by 22 in outside and is of uniform width. Using algebraic methods, what is the width of the frame if the inner area of the picture shown is 250 in²2? Write answer to 2 decimal places. (Write the number with no units). 18 in Your Answer: 22 inarrow_forward◄ Listen A vacant lot is being converted into a community garden. The garden and a walkway around its perimeter have an area of 560 square feet. Find the width of the walkway (x) if the garden measures 15 feet wide by 19 feet long. Write answer to 2 decimal places. (Write the number without units). X 15 feet Your Answer: 19 feet Xarrow_forwardListen A stuntman jumps from a roof 440 feet from the ground. How long will it take him to reach the ground? Use the formula, distance, d = 16t2, (where t is in seconds). Write answer to 1 decimal place. (Write the number, not the units). Your Answer:arrow_forward
- Solve using the quadratic equation formula 4x² + 12x=-6 ○ a) -12±√√3 2 b) -3±√15 -3+√15 2 ○ c) c) -3±√√√3 2 d) -3±√3 8arrow_forwardListen Solve the quadratic equation by factoring. One solution is 0. Find the other. 2x² + 16x = 0 Your Answer: Answerarrow_forwardSolve x²+4x-45 = 0 ○ A) -9,5 ☐ B) -15, 3 C) -3,15 D) -5,9arrow_forward
- Solve 3x² + 2x-5=0 О ○ A) 3,- 11/1 ○ B) 1,- 5/35 5 Oc)-1, 33 ○ D) 1, - 3/3arrow_forwardFactor the polynomial completely. x^2- 9 A) (x - 1)(x -9) B) (x - 3)(x + 3) c) (x -3)(x-3) D) (x + 3)(x + 3)arrow_forwardPlease solve the following Probability problem. Show all work and solve all parts that are asked: HW 1.y.(Yutnori) Yutnori is played by 2 (groups of) players on a gameboard with pieces thatmove around. Each player takes turns throwing yut sticks - each stick hastwo sides, round and flat, which makes the stick roll. Five combinationsare possible with yut sticks: do, gae, geol, yut and mo. A player achievinga yut or mo is allowed to roll again. Combinations and the number ofmoves they allow on the gameboard are presented in Figure 3 (flat sideup is blank and round side up is filled with x-es). Assuming each of the 4 Yut sticks falls on both of its sides with equalprobability, what is the probability that:a) you roll a yut?b) you roll a geol ?c) you get a second roll?d) you move 6 spaces in your first turn?In reality, a typical Yut stick is designed so that the probability of flat sidefacing up is around 60%. Try to think of what the previous probabilitieswould be in this case.arrow_forward
- Linear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage LearningAlgebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage