Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Recursion Question 3 ( 2 0 . 0 marks ) Your lecturer is a funny guy; given an unsorted list of integer numbers of n

Recursion Question 3(20.0 marks) Your lecturer is a funny guy; given an unsorted list of integer numbers of n elements, and to find the sum of all the numbers in the list, he will use the following algorithms. function Sum(A, left, right) if left > right: return 0 else if left = right: return A[left] mid = floor((left+right)/2) Isum = Sum(A, left, mid) rsum = Sum(A, mid+1, right) return Isum + rsum + A[mid] function myMethod(A, N) B = new Array of length 1 B[0]= Sum(A,O, N-1) return B (a) Analyse the asymptotic run-time complexity of the method myMethods. Give the worst-case and the best-case running time in terms of o notation. Justify your answer. (15.0 marks)(b) Explain briefly, in words, why the best-case inputs and the worst-case inputs are the same for the myMethods. (5.0 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago

Question

Question May a taxpayer roll over money from an IRA to an HSA?

Answered: 1 week ago

Question

Question What is the doughnut hole in HSA coverage?

Answered: 1 week ago