Question: What would be the time complexity of the following algorithm? reverse(a): for i = 1 to len(a)-1 X = a[i] for j - i downto
What would be the time complexity of the following algorithm? reverse(a): for i = 1 to len(a)-1 X = a[i] for j - i downto 1 au a0] = a[j-1] a[e] -X O O(n) O O(n/2) O(n) O O(n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
