Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) Give an analysis of the running time of the following program fragment and obtain the running time (Big-Oh), i.e. if the order of complexity

(a) Give an analysis of the running time of the following program fragment and obtain the running time (Big-Oh), i.e. if the order of complexity is O(f(n)), then f(n)=?.

sum = 0;

for( i = 0; i < n; ++i )

for( j = 0; j < i * i; ++j )

for( k = 0; k < j; ++k )

++sum;

(b) An algorithm takes 0.5 ms for input size 100. How long will it take for input size 500 if the running time is the following (assume low-order terms are negligible)?

a. linear , b. O(N logN), c. quadratic , d. cubic

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago