[solved]-Worst Case Average Case Complexity Respectively Following Code Rand0 K Generates Random Nu Q39069787

What are the worst case and average case complexity, respectively, of the following code? (“rand0% k” generates a random number in the range 0..k-1 and runs in O(1) time). vector<int> loadVector(int n) vector<int> v; for (int i = 0; i < n; ++i) if (rand() % n == 0) for (int j = 0; j<n; ++j) v.push_back(rand() % n); return v Worst: O(n), average: O(n) worst: O(n), average: (n2) worst: O(n2), average: O(n) worst: O(n2), average: O(n2 worst: O(n), average: 0(n2 None of the above Show transcribed image text What are the worst case and average case complexity, respectively, of the following code? (“rand0% k” generates a random number in the range 0..k-1 and runs in O(1) time). vector loadVector(int n) vector v; for (int i = 0; i
Expert Answer
Answer to What are the worst case and average case complexity, respectively, of the following code? (“rand0% k” generates a random… . . .
OR

