Answered step by step
Verified Expert Solution
Question
1 Approved Answer
8/26/2020 Q 1.13. Consider the problem of finding the sum of the first n tetrahedral numbers, or simply STH. a). Formulate the problem. b). Provide
8/26/2020 Q 1.13. Consider the problem of finding the sum of the first n tetrahedral numbers, or simply STH. a). Formulate the problem. b). Provide computational time complexities of the following algorithms to find STH(n): Algorithm 1.15. STH-1 STH(n) o=0 ..................1 for i I...... for In for k=1}......4 O=o+k.......5 return o.........6 Algorithm 1.16. STH-2 STH(n) O=0. 1 for il for j=1 3 4 return o.............5 Algorithm 1.17. STH-3 STH(n) O=0........ for i 1........2 Oo + +1 1+2 3 return o 4 0=0+ +1 c). Derive a closed formula for STII(n). d). Prove the correctness of your closed formula. Q 1.17. Consider the minimum consecutive subsequence sum problem, minCSS for short, which finds the consecutive subsequence of a sequence A = (01.02...0) whose sum is the minimum of the sums of all consecutive subsequences. Let A = (41,42,...) be a sequence of arbitrary real numbers. a). Formulate the problem. b). What is the minimum consecutive subsequence sum on the following toy example? -15-3-374-1 c). Derive a nave algorithm from the problem's definition. d). Provide the computational time complexity of the proposed algorithm in c). 2 8/26/2020 Q 1.13. Consider the problem of finding the sum of the first n tetrahedral numbers, or simply STH. a). Formulate the problem. b). Provide computational time complexities of the following algorithms to find STH(n): Algorithm 1.15. STH-1 STH(n) o=0 ..................1 for i I...... for In for k=1}......4 O=o+k.......5 return o.........6 Algorithm 1.16. STH-2 STH(n) O=0. 1 for il for j=1 3 4 return o.............5 Algorithm 1.17. STH-3 STH(n) O=0........ for i 1........2 Oo + +1 1+2 3 return o 4 0=0+ +1 c). Derive a closed formula for STII(n). d). Prove the correctness of your closed formula. Q 1.17. Consider the minimum consecutive subsequence sum problem, minCSS for short, which finds the consecutive subsequence of a sequence A = (01.02...0) whose sum is the minimum of the sums of all consecutive subsequences. Let A = (41,42,...) be a sequence of arbitrary real numbers. a). Formulate the problem. b). What is the minimum consecutive subsequence sum on the following toy example? -15-3-374-1 c). Derive a nave algorithm from the problem's definition. d). Provide the computational time complexity of the proposed algorithm in c). 2
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started