Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Func7(n) 1 s0; 2 in; 3 while (1) do for j1 to i do 4 5 ss+i-j; 6 end 7 8 end iti-n;

image text in transcribedimage text in transcribed

2. Func7(n) 1 s0; 2 in; 3 while (1) do for j1 to i do 4 5 ss+i-j; 6 end 7 8 end iti-n; 9 return (s); T(n) = i for in, n n, n 2n, ..., n-kn=0 = n + (n n) + (n 2n) + + (n-kn), where k = n/n = n.5 - - = kn-n (1+2++k)=(kn) = (n) Or, another way to do it: T(n) = i forin, n n, n 2n, ..., n kn = 0 = 0 + n +2 n + + n, where n = n.5 n =(1+2+3++n25)=n - (n) = (n )

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

Managerial Accounting

Authors: John J. Wild, Ken W. Shaw

2010 Edition

9789813155497, 73379581, 9813155493, 978-0073379586

Students also viewed these Algorithms questions

Question

What are the roots of (a) x2 6x + 8, (b) 3x2 2x 5, (c) x2 + x + 1?

Answered: 1 week ago

Question

=+c) In what month of the year are gas prices highest?

Answered: 1 week ago

Question

What is managements primary objective?

Answered: 1 week ago

Question

What is a classifi ed balance sheet?

Answered: 1 week ago