Question: For the following algorithm:[Q1 multi]What is the time complexity in the worst case? ALGORITHM XYZ (A, n) // Input: An array of n elements
For the following algorithm:[Q1 multi]What is the time complexity in the worst case? ALGORITHM XYZ (A, n) // Input: An array of n elements sum = 0 for c = 1 to 1000 do if A[c] < 0 then for k=1 to n do sum = sum + k. A[c] return sum O a. 0(1) O b. O(n^2) O c. 0(1000 n) O d. O(n) O e. None
Step by Step Solution
3.42 Rating (146 Votes )
There are 3 Steps involved in it
The detailed answer for the above question is provided below The provided algorithm XYZ involves two ... View full answer
Get step-by-step solutions from verified subject matter experts
