Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

what is the value is returend by function pesky (n). Express your answer in trems of n . what is the worst case complexity of

image text in transcribed

what is the value is returend by function pesky (n). Express your answer in trems of n . what is the worst case complexity of the nested loop above? what is the right from 1 to 4?

1- pesky (n)= n(n+1)/2. Complexity O(n^2)

2- pesky (n)= n^2(n+1)/2. Complexity O(n^3)

3- pesky (n)= n^2(n+1)^2/2. Complexity O(n^4)

4- pesky (n)= n(n+1)(n+2)/6 Complexity O(n^3)

5- pesky (n)= n^2(n+1)/2. Complexity O(n^4)

Algorithm 1 function Pesky(n) Require: An integer n20 2: for i-1 to n do 3: for j 1 to i do 4: for kj toi +j do 5: 6 end for 7: end for 8: end for 9: return r

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions