Identify and justify the asymptotic run time of this algorithm in terms of n.
stepRightUp (A,n)
1 for i = 1 ton - 1
2 for j 1 to n 1
3 if A[j] > A[j+1]
4 temp = A[j]
5 A[j]=A[j+1]
6 A[j+1]= temp
A. Line 1 for loop runs O(n) times; line 2 for loop runs O(n) times; lines 3-6 can run up to O(n) times; multiply these together to get O(n*n*n) O(n³)
B. Line 1 for loop runs O(n) times; line 2 for loop runs e(n) times; lines 3-6 are (1); multiply these together to get O(n*n*1)
= O(n²)
OC. Line 1 for loop runs O(n) times; line 2 for loop runs O(n) times; lines 3-6 are O(1); add these together to get O(n+n+1)= O(n)
D. Due to test in line 3, asymptotic run time depends on whether the data is sorted or not.
E. Line 1 for loop runs O(n) times; line 2 for loop runs O(n) times; lines 3-6 can run up to O(n) times; add these together to get O(n+n+n) = O(n)