I have to find the time complexity of the pseudocode I have created and specify it using the Big-O notation. The problem is that I don't know how to calculate it when I have an if-statement inside nested for-loops.
Here is my pseudocode, what is in brackets is the number of operations:
Algorithm largestProduct(A)
Input array A
Output largest product value of two elements in array A, the values and their indices
index1 ← 0 (1)
index2 ← 0 (1)
n ← A length (1)
max ← 0 (1)
for i ← 0 to n-1 do (n)
for j ← i + 1 to n do (n^2)
if max < A[ i ] * A[ j ] then (?)
max ← A[ i ] * A[ j ]
index1 ← i
index2 ← j
return max, A[index1], index1, A[index2], index2
Thank you in advance for your help.