Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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,0, 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)

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

a. What aspects of the situation are under your control?

Answered: 1 week ago

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago

Question

LO4 Provide an overview of four challenges facing HR today.

Answered: 1 week ago