Question



Expert G8A 1.4.6 Give the order of growth (as a function of N) of the running times of each of the following code fragments: a. int sum -0 for (int n-N; 0: n / 2) for(int i 0; i < n; i++) sum+ b int sum-0 for (int i-li<N; i-2) for Cint 3-0:3 i: j) sum++ 4Analysls of Algorithms int sum 0 for (int i-1i<N: i-2) for Cint i-0:3N: j) sum++
0 0
Add a comment Improve this question Transcribed image text
Answer #1

somt TM o, the sm would be tsend Thal ndos b. zl is sinilan to above case ene, also the imen loop łajuy o n (n) n 2 O IntRead the images carefully,

hope you will understand

Add a comment
Know the answer?
Add Answer to:
Expert G8A 1.4.6 Give the order of growth (as a function of N) of the running...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.4.6 Give the order of growth (as a function of n) of the running times of...

    1.4.6 Give the order of growth (as a function of n) of the running times of each of the following code fragments: a, int sum=0; for (int k n: k > 0; k /= 2) for (int i 0; ǐ < k; İ++) sum++; b.int sum 0; for (int i = 1; i < n; i *= 2) for (int j = 0; j < i; j++) sum++; int sum = 0; for (int í = 1; i < n;...

  • Please DONOT attempt this Big O question if you don't know the exact answer. Algorithms question...

    Please DONOT attempt this Big O question if you don't know the exact answer. Algorithms question (Big O): Please explain me in details the order of growth (as a function of N) of the running times of each of the following code fragments: a)         int sum = 0; for (int n = N; n > 0; n /= 2)    for(int i = 0; i < n; i++)      sum++; b)         int sum = 0; for (int i =...

  • 8.         R-4.8 Order the following functions by asymptotic growth rate. 4nlogn + 2n 2^10    2^logn 3n...

    8.         R-4.8 Order the following functions by asymptotic growth rate. 4nlogn + 2n 2^10    2^logn 3n + 100logn      4n     2^n n^2 + 10n        n^3       nlogn 9.         R-4.9 Give a big-Oh characterization, in terms of n, of the running time of the example 1 method shown in Code Fragment 4.12. 10.       R-4.10 Give a big-Oh characterization, in terms of n, of the running time of the example 2 method shown in Code Fragment 4.12. 11.       R-4.11 Give a big-Oh characterization, in...

  • For each of the following six program fragments: a. Give an analysis of the running time...

    For each of the following six program fragments: a. Give an analysis of the running time (Big-Oh will do). b. Implement the code in the language of your choice, and give the running time for several values of N. Pseudo Code Implementation Analysis of runtime time (Big-Oh) (1) sum = 0; for(i = 0; i < n; ++i) ++sum; (2) sum = 0; for(i = 0; i < n; ++i) for(j = 0; j<n; ++i) ++sum; (3) sum = 0;...

  • Exercises • Determine running time for the following code fragments: (a) a = b + c;...

    Exercises • Determine running time for the following code fragments: (a) a = b + c; d = a + e; (b) sum = 0; for (i=0; i<3; i++) for (j=0; j<n; j++) sum++; (c) sum=0; for (i=0; i<n<n; i++) sum++; (d) for (i=0; i < n-1; i++) for (j=i+1; j <n; j++) { tmp = A[i][j]; A[i][j] = A[j] [i]; A[j][i] = tmp; (e) sum = 0; for (i=1; i<=n; i++) for (j=1; j<=n; j+=2) sum++;

  • Give a big-Oh characterization, in terms of n,of the running time for each of the following...

    Give a big-Oh characterization, in terms of n,of the running time for each of the following code segments (use the drop-down): - public void func1(int n) { A. @(1). for (int i = n; i > 0; i--) { System.out.println(i); B. follogn). for (int j = 0; j <i; j++) System.out.println(j); c.e(n). System.out.println("Goodbye!"); D.@(nlogn). E.e(n). F.ein). public void func2 (int n) { for (int m=1; m <= n; m++) { system.out.println (m); i = n; while (i >0){ system.out.println(i); i...

  • in my c++ class i need help with these question please Question 1. Indicate whether the...

    in my c++ class i need help with these question please Question 1. Indicate whether the first function of each of the following pairs has a smaller, same, or larger order of growth (to within a constant multiple) than the second function. Use the correct notation to indicate the order of growth (f(n) ∈O(g(n)), Ω(g(n)), or Θ(g(n)) as applicable). Prove your statement using limits. (a) (lnn)2 and lnn2 (b) 42n+1 and 42n Question 2. Use the formal definitions of O,...

  • Problem 1. Select the running time of each function. void print_array (int* A, int n) for...

    Problem 1. Select the running time of each function. void print_array (int* A, int n) for (int í 0; i < n; ++i) cout << A[i] << endl; void print_array pairs (int* A, int n) for (inti 0; i < n; ++i) for (int j 0; j < n; ++j) cout << Ai] ALj]< endl; void print_array_start(int* A, int n) for (int i 0; i < 100 ; ++i) cout << A[i] << endl; void print_array_alt (int* A, int n)...

  • 1 question) Arrange the following in the order of their growth rates, from least to greatest:...

    1 question) Arrange the following in the order of their growth rates, from least to greatest: (5 pts) n3                     n2         nn        lg n     n!       n lg n              2n                     n 2 question)Show that 3n3 + n2 is big-Oh of n3. You can use either the definition of big-Oh (formal) or the limit approach. Show your work! (5 pts.) 3 question)Show that 6n2 + 20n is big-Oh of n3, but not big-Omega of n3. You can use either the definition of big-Omega...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT