Question

Hello, i need help finding the time complexity(big0) for n..(java) a) for (int a = 0;...

Hello, i need help finding the time complexity(big0) for n..(java)

a)

for (int a = 0; a < n; a = a + C)

for (int b = 0; b < 10; b++)

s[a] += b * s[a];

b)

for (int a = 1; a < n; a = a * C)

for (int j = 0; j < a; j++)

   s[a] += j * s[a];

c)              

for (int i = 1; i < n; i = i * 2)

for (int j = 0; j < n; j++)

s[i] += j * s[i];

Thanks for your help!

              

          

      

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Hello, i need help finding the time complexity(big0) for n..(java) a) for (int a = 0;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • #9 What is time complexity of fun()? int fun(int n) {   int count = 0;   for...

    #9 What is time complexity of fun()? int fun(int n) {   int count = 0;   for (int i = n; i > 0; i /= 2)      for (int j = 0; j < i; j++)         count += 1;   return count; } Group of answer choices O(n^2) O(nLogn) O(n) O(nLognLogn)

  • Hey, I really need help understanding the math get the answer that is given. Please help....

    Hey, I really need help understanding the math get the answer that is given. Please help. Thanks in advance. for (int k =0; k s Ign; k++) {for (int i =0; is n2; i++) Print “Hello World"; for (int j =0; j s n; j++) Print “Hello World"; } When n = 2, how many times will “Hello World” be printed?16 When n =4, how many times will “Hello World” be printed? 66 Assuming that the print is the basic...

  • What is the time complexity of the following code segment? for (int i = 0; i<n;...

    What is the time complexity of the following code segment? for (int i = 0; i<n; i--) if (a[i] != 0) sum = a[i]; What is the time complexity of the following code segment? for (int i = 0; i<10; i++) if (a[i] != 0) sum += a[i]; What is the time complexity of the following code segment? for (int i = 0; i<n/2; i++) if (a[i] != 0) sum += a[i]; What is the time complexity of the following...

  • Array manipulation (a) Write Java code for a method exchange (int [] a, int i, int...

    Array manipulation (a) Write Java code for a method exchange (int [] a, int i, int j) that exchanges the values stored at indices i and j in the array a. You do not need to worry about cases where either i or j is an invalid index. Give the best estimate you can for its time complexity (b) In an ordered array of n items, how can we determine whether or not an item belongs to the list using...

  • Using C++ please explain What is the Big-O time complexity of the following code: for (int...

    Using C++ please explain What is the Big-O time complexity of the following code: for (int i=0; i<N; i+=2) { ... constant time operations... Select one: o a. O(n^2) O b. O(log n) c. O(n) O d. 0(1) What is the Big-O time complexity of the following code: for(int i=1; i<N; i*=2) { ... constant time operations... Select one: O O a. O(n^2) b. 0(1) c. O(n) d. O(log n) O What is the Big-O time complexity of the following...

  • 1). What is the complexity of the following code snippet? { for (int count2 = 0;...

    1). What is the complexity of the following code snippet? { for (int count2 = 0; count2<n; count2++) { /*some sequence of O(1) step*/ } } select one: a. O(N^2) b. O(Log N) c. O(1) d. O(N!) 2). What is the complexity of the following code snippet? for (int count = 0; count<n; count++) { printsum(count) } select one: a. We need to know the complexity of the printsum() function. b. O(Log N) c. O(1) d. O(N) e. O(N^2) 3)....

  • Need some help with finding the runtime of these java functions in the form of exact,...

    Need some help with finding the runtime of these java functions in the form of exact, tilde and big oh notation: Example of how: Func Exact Tilde O() Example 1 1 ~1 O(1) Example 2 2n+1 ~2n O(2n) Here are the functions: void funcA(int n) {         step();         for (int i = 0; i < n; i++) {             funcA(n-1);         }     }     void funcB(int n) {         step();         if (n > 0)             funcB(n-1);    ...

  • Analyze the following programs and show their time complexity functions and big-O notations. for(int i =...

    Analyze the following programs and show their time complexity functions and big-O notations. for(int i = 1; i <= n; i+=3) { for(int j=1; j <= n; j++) { if (j % 3 == 0) { // 4 assignments } if (2*i + 3 == 5) { // 17 assignments } } }

  • Hello, I would like to get help with the following algorithms and their respective analysis of...

    Hello, I would like to get help with the following algorithms and their respective analysis of runtime along with their recurrence equations, thanks in advance. 1.       Analyze each of the following algorithms by providing a tight big-Oh bound on the run time with respect to the value n. Create a recurrence equation. a.     void padawan(int n) {       if( n <= 10 )             time++;       else       {             for(int i=0; i<n; i++)                         time++;             padawan(n/3);             padawan(n/3);             padawan(n/3);       } } b.    void nerfHerder(int n)...

  • discrete math (1) (15 pts) Time Complexity Analysis 1) (5 pts) What is the time complexity...

    discrete math (1) (15 pts) Time Complexity Analysis 1) (5 pts) What is the time complexity of the following code segment? Explain your answer; otherwise, you can't get full mark from this question. for(int i=1; i<n; i*=2) { sum-0; sum++; Answer: 2) (5 pts) What is the time complexity of the following code segment? Explain your answer; otherwise, you can't get full mark from this question. for(int j=0; j<n; j++){ for (int k=0; k<n; k++) { for (int =0; i<n;...

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