Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started