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 and Its Applications
- please solve this problem step by step and make it quick pleasearrow_forward8.67 Free recall memory strategy. Psychologists who study ①memory often use a measure of "free recall" (e.g., the RECALL number of correctly recalled items in a list of to-be- remembered items). The strategy used to memorize the list-for example, category clustering-is often just as important. Researchers at Central Michigan University developed an algorithm for computing measures of cat- egory clustering in Advances in Cognitive Psychology (Oct. 2012). One measure, called ratio of repetition, was recorded for a sample of 8 participants in a memory study. These ratios are listed in the table. Test the theory that the average ratio of repetition for all participants in a similar memory study differs from .5. Select an appropriate Type I error rate for your test. .25 .43 .57 .38 .38 .60 .47 .30 Source: Senkova, O., & Otani, H. "Category clustering calculator for free recall." Advances in Cognitive Psychology, Vol. 8, No. 4, Oct. 2012 (Table 3).arrow_forwardWithout solving explicitly, classify the critical points of the given first-order autonomous differential equation as either asymptotically stable or unstable. All constants are assumed to be positive. (Enter the critical points for each stability category as a comma-separated list. If there are no critical points in a certain category, enter NONE.) mdv/dt = mg − kv asymptotically stable v= unstable v= nonearrow_forward
- 61 6) One kilogram of ground nutmeg cost $A. You repackage it, mark the price up 125% and sell it by the ounce. What is your price per 1 ounce of nutmeg? [DA] 120arrow_forward8.64 Radon exposure in Egyptian tombs. Refer to the D Radiation Protection Dosimetry (Dec. 2010) study TOMBS of radon exposure in Egyptian tombs, Exercise 7.39 (p. 334). The radon levels-measured in becquerels per cubic meter (Bq/m³)-in the inner chambers of a sam- ple of 12 tombs are listed in the table. For the safety of the guards and visitors, the Egypt Tourism Authority (ETA) will temporarily close the tombs if the true mean level of radon exposure in the tombs rises to 6,000 Bq/m³. Consequently, the ETA wants to conduct a test to deter- mine if the true mean level of radon exposure in the tombs is less than 6,000 Bq/m³, using a Type I error probabil- ity of .10. A SAS analysis of the data is shown on p. 399. Specify all the elements of the test: Ho, Ha, test statistic, p-value, a, and your conclusion. 50 390 910 12100 180 580 7800 4000 3400 1300 11900 1100 N Mean Std Dev Std Err Minimum Maximum 12 3642.5 4486.9 1295.3 50.0000 12100.0arrow_forwardReduction in the particle size of a drug in a solid dosage form results in its faster dissolution. Please select one of the following correct option with respect to this statement A. Yes because reduction in size results in decrease in surface area B. Yes because reduction in size results in increase in surface area C. The above statement is incorrect because rate of dissolution, in fact, decreases with decrease in particle size of the drug __ Only B is correct __ Only C is correct __ Only A is correctarrow_forward
- Show all steps. Correct answer is 37.6991118arrow_forward3. Which of the following mappings are linear transformations? Give a proof (directly using the definition of a linear transformation) or a counterexample in each case. [Recall that Pn(F) is the vector space of all real polynomials p(x) of degree at most n with values in F.] ·(2) = (3n+2) =) · (i) 0 : R³ → R² given by 0 y 3y z ax4 + bx² + c). (ii) : P2(F) → P₁(F) given by (p(x)) = p(x²) (so (ax² + bx + c) = ax4 þarrow_forward2. Let V be a vector space over F, and let U and W be subspaces of V. The sum of U and W, denoted by U + W, is the subset U + W = {u+w: u EU, w Є W}. Prove that U + W is a subspace of V.arrow_forward
- Linear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage LearningAlgebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage