Name: Anonymous 2014-02-10 15:12
Hey prog what is the worst case
Algorithm Inc(n, A[1::n])
j <-- 1
P <-- 1
while j n
k <-- A[j]
S <-- 0
while j n and j < k
S <-- S + A[j]
j <-- j + 1
P <-- P < S
j <-- j + 1
return P
Algorithm Inc(n, A[1::n])
j <-- 1
P <-- 1
while j n
k <-- A[j]
S <-- 0
while j n and j < k
S <-- S + A[j]
j <-- j + 1
P <-- P < S
j <-- j + 1
return P