Need of help Consider the following recursive function that takes as arguments a
ID: 3771952 • Letter: N
Question
Need of help
Consider the following recursive function that takes as arguments an array L and two nonnegative integers first and last, that serve as indices into L. Therefore, if L has length n, then first and last are guaranteed to be in the range 0 through n - 1 What is the value returned by the function call strangeSum(L, 0, 3) where L is the array [1, 4, 2, 3). Write a recurrence relation describing the running time the function call strangeSum(L, 0, r,-1) oil an array L of length n. Solve the recurrence in to obtain the running time of the function call strangSum(L, 0, n-1), in terms of n, the length of the given array L of length n.Explanation / Answer
a) Left sum = 1+4, midsum = 4+2 and rightsum= 2+3 so the value returned will be 5+6+5=16
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.