tructure.com/courses/35338/discussion topics/351093?module item id-1793583 This
ID: 3737303 • Letter: T
Question
tructure.com/courses/35338/discussion topics/351093?module item id-1793583 This is a graded discussion: 100 points possible D1: Analysis of Algorithms due Mar 26 1) Please look at the C++function given below. If this function is called with n-10 "myFunc(10" and n-5 "myFunc(5)," how many time do you think the highlighted statement will be executed for each case? 2) If the highlighted statement takes 5 microsecond for single time of execution, what would be the execution time in terms of minutes if n-10°? Is this an efficient computation time? Why? 2 void myFunc (int n) int value; for (int io, iExplanation / Answer
/*If you have any query do comment in the comment section else like the solution*/
The given function contains a nested for loop in which the inner loop runs for n times for each value of i that is n*n times hence the highlighted statement will be executed n2 times.
If a single execution takes 5 micro second then it will take 5*n2 second to complete the execution therefore for n=109 the loop will be executed 1018 times and therefore total time taken will be 5*1018 micro second will be 83333333333.335 minutes.
No it's not an effective computation times any algorithm going into n2 will be efficient only for small values of n say n<=10000.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.