Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q-2) Given the below: (i) Given the following source code where n = number of data points: for( int i = 0; i < 100*n;

Q-2) Given the below: (i) Given the following source code where n = number of data points: for( int i = 0; i < 100*n; ++i) { // cost for line? for( int j = 0; j < 50*n; ++j) { // cost for line? sum += i*j; // cost for line? } } It is found the cost function of the code is: T(n) = c0*(100*n + 1) + c1*(100*n)*(50n + 1) + c2*100n*50n. Reducing and collecting produces: T(n) = c0*100n + c0 + c1*5000n^2 + c1*100n + c2*5000n^2 T(n) = c0 + c0*100n + c1*100n + c1*5000n^2 + c2*5000n^2 T(n) = (c0 + c0*100 + c1*100)n + (c1*5000 + c2*5000)n^2 Replacing the constant terms with the values c3 = c0 + c0*100 + c1*100 and c4 = c1*5000 + c2*5000. Produces: T(n) = c4*n2 + c3*n Determine which is true: For any c3,c4 > 0 is it true T(n) (n2) as n-> . For any c3,c4 > 0 is it true T(n) (n2) as n-> . For any c3,c4 > 0 is it true T(n) (n2) as n-> . Show all logic and work using the inequality proof tests: i.e. for f(n) O(g(n)) show that f(n) <= c*g(n) where c > 0 as n-> .

please explain how you got your answer

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

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions