Question
Describe the worst case running time of the following pseudocode functions in Big-Oh notation in terms of the variable n. Show your work
b) void func(int n) { for (int i = 0; i < n; i = i + 10) { for (int j = 0; j < i; ++i) { System.out.println(i = + i); Syst
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution: According the give code, the iterator variable i is initialised to 0 and runs until i<n. Here the increment in the

Add a comment
Know the answer?
Add Answer to:
Describe the worst case running time of the following pseudocode functions in Big-Oh notation in terms...
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
  • 4. Big-Oh and Rune time Analysis: describe the worst case running time of the following pseudocode...

    4. Big-Oh and Rune time Analysis: describe the worst case running time of the following pseudocode functions in Big-Oh notation in terms of the variable n. howing your work is not required (although showing work may allow some partial t in the case your answer is wrong-don't spend a lot of time showing your work.). You MUST choose your answer from the following (not given in any particular order), each of which could be re-used (could be the answer for...

  • 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...

  • 6. Using big-oh notation, give the runtime for each of the following recursive functions. You do...

    6. Using big-oh notation, give the runtime for each of the following recursive functions. You do not need to justify your answers: a) Int nonesense (int n) if (n <0) return 1; return nonsense (n-2) 1; b) int no nonesense (int n) if (n <0) return 1; return no_nonsense (n-1)+ no nonsense (n-1)

  • Which big-O expression best characterizes the worst case time complexity of the following code? public static...

    Which big-O expression best characterizes the worst case time complexity of the following code? public static int foo(int N) ( int count = 0; int i1; while (i <N) C for (int j = 1; j < N; j=j+2) { count++ i=i+2; return count; A. O(log log N) B. O(log N2) C. O(N log N) D. O(N2)

  • Describe the order of magnitude of the following code section using Big(O) notation. k=0; for (i=...

    Describe the order of magnitude of the following code section using Big(O) notation. k=0; for (i= 0; i<N; i++)

  • 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...

  • Provide a "big oh" run-time analysis for each of the following. When a value of “n”...

    Provide a "big oh" run-time analysis for each of the following. When a value of “n” is used, it is the size of the input. 4.) void problem 40 cin n min max for (int i min i n, i++) for (int j- 1: j< max, j++) tota while (total n tota total 2 total 5.) void problem 50 cin n; for (int i 0: i n, i++) for (int j 0; j i2; j++) for (int k 0; k...

  • Compute the Big O notation. Explain how you got the answer. on W NA 1 public...

    Compute the Big O notation. Explain how you got the answer. on W NA 1 public String modify (String str) { if (str.length() <= 1) return ""; int half = str.length() / 2; modify(str.substring(half)); 5} 1 2 3 for (int i = 0; i<n; i++) { for (int j 0; j < 5; j++) { for (int k = 0; k<n; k++) { 4 if ((i != j) && (i != k)) { 5 System.out.println(k); 6 } 7 } 8...

  • 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)...

  • Please provide the big oh notation for running time and space complexity for the following functions...

    Please provide the big oh notation for running time and space complexity for the following functions (available, into, out, size, and printAll): int SplayTreeInventory::available(string id){   Node* temp=stmap->findSplay(id); if(temp!=NULL) return temp->value; else return -1;   } void SplayTreeInventory::into(string id, int amount) { Node* temp=stmap->findSplay(id); if(temp==NULL){ stmap->putSplay(id, amount); } else{ temp->key+=amount; } } void SplayTreeInventory::out(string id, int amount) { Node* temp=stmap->findSplay(id); if(temp==NULL){ } else{ if(temp->value<=amount) stmap->erase(id); else temp->value-=amount; } } int SplayTreeInventory::size() { return stmap->size(); } void SplayTreeInventory::printAll() { printAllHelper(this->stmap->root); }

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