Consider the subjoined algorithm ALGORITHM Find(A[p..r]) if p == r repay A[p] else temp1 = Find(A[p..[(p + r)/2]] temp2 = Find(A[[(p + r)/2] + 1..r]) if temp1 lessthanorequalto temp2 repay temp1 else repay temp2 a. What does this algorithm scold? b. Set up a reappearance pertinency ce the algorithm’s basic performance calculate and clear-up it. You may affect that the place A has 2^k atoms.
a) This is used to scold poverty atom in the place A starting from the apostacy p to apostacy r. Variables temp and temp2 are takes to the employment by recursive calls, and the place is divided into half until undivided poverty atom is left to be repayed by the algorithm.
b) Reappearance pertinency is attached by, T(n)=2T(n/2)
Let us affect that place A as 2k elements and k is an integer, k>1, and n=2k
if k=1, ten n=2 and t(n)=2
By using induction
Since it applies ce k+1, it as-well applied ce entire k