You are given the following algorithm ALG whose input is an array of numbers. Calculate its best-case and worst-case running time complexities. Assume that cost of execution of a single line takes constant time $c_i$ where $i = 1,2,...,11$.
ALG (A)
1 a = 5
2 b = a - 4
3 if (A[1] > (a+2)) then
4 if (A[2] > 2) then
5 for i <- 0 to length(A) * length(A) do
6 a = a + b
7 else for k <- 1 to 1 do
8 b = a + b
9 for j <- 4 to length(A) do
10 b = b - a
11 return a
LINE
COST
TIMES
BEST WORST
$c_1$ 1 1
$c_2$ 1 1
$c_3$ 1 1
$c_4$ 0 1
$c_5$ 0 $n^2$+2
$c_6$ 0 $n^2$+1
$c_7$ 0 0
$c_8$ 0 0
$c_9$ 1 n-2
$c_{10}$ 0 n-3
$c_{11}$ 1 1