Question: Having issues with my time complexity formula, please review my analysis to make sure it's correct. I need my Analytical and Empirical Outputs to match.
Having issues with my time complexity formula, please review my analysis to make sure it's correct. I need my Analytical and Empirical Outputs to match.
The code:
sum=0; for(i=0;iMy analysis (please see for how I computed my T(n) I suspect i have it wrong, code below is just its implementation): https://comphonia.com/share/sa.htm
Analytical code:
int af4(int n){ return 3*n*n+4*n+3; }Empirical Code:
int ef4(int n){ int t=0; int sum =0; t++; int i=0; t++; while(iOutput:
N Analytical Empirical 0 3 3 1 10 7 10 343 43 20 1283 83 30 2823 123 40 4963 163 50 7703 203 60 11043 243 70 14983 283 80 19523 323 90 24663 363When I swap i for n in my 2nd while loop I get similar af4 and ef4 so I'm guessing my analysis is wrong.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
