For each of the given algorithms:
1. Determine the asymptotic complexity of the worst-case running time.
2. Determine the asymptotic complexity of the best-case running time.
3. Determine the expected runtime of the algorithm. Fully justify your solutions.
Assume that Random(n) generates a random integer between 1 and n with a uniform distribution.
function Func(A, n)
x = 0
k = Random(n^2)
for i = 1 to k do
for j = 1 to i do
x = x + A[i] - A[j]
end for
end for
return x
end function