Page 1 of 1

Find asymptotic runtimes of the following functions. Give runtime in terms of Big-O function of n int functionA (int n)

Posted: Mon May 09, 2022 6:01 am
by answerhappygod
Find Asymptotic Runtimes Of The Following Functions Give Runtime In Terms Of Big O Function Of N Int Functiona Int N 1
Find Asymptotic Runtimes Of The Following Functions Give Runtime In Terms Of Big O Function Of N Int Functiona Int N 1 (95.7 KiB) Viewed 17 times
Find asymptotic runtimes of the following functions. Give runtime in terms of Big-O function of n int functionA (int n) { (6) Asymptotic runtime of functionA int i = n, j, sumA = 0; for (i=10; i < n; i=i+10) { j = i; while (j < n) { sumA = sumA + (i * j); j++; } } return sumA; (7) Asymptotic runtime of functions int functions (int n) { int i, j, sumB = 0; for (i=n; i > 1; i=i/2) { if (i % 10 == 0) continue; for (j=1; j < n; j-j*2) sumB = sumB + i + j; } return sumB;
(8) Asymptotic runtime of function (9) Asymptotic runtime of functionD int function (int n) { int i, j, sumC = 0; for (i=n; i > 0; i=i-5) for (j=1; j<n; j-j*5) sumC++; return sumc; } int functionD (int n) { int i, sumD = 0; for (i=1; i < n/2; i++) { sumD = sumD + functionA(n); } return sumD; } int functionE (int n) { int i, m = n; int sumE = functionB(n/2); while (n > 0) { if (function(n) % 2 == 0) { for (i=m; i > 0; i-i/3) sumE++; } else { for (i=m; i > 0; i=i-3) sumE--; } n--; } return sumE; (10) Asymptotic runtime of functione