in DS retagged by
141 views
0 votes
0 votes
Compute the running time for the following algorithm

ALGORITHM RKU(a,k,n)

//Input: a is an array of n element and k is a value

{

if( k == n) then

{

WRITE(a[1:n]);

return 0;

}

else

{

for i ← k to n do

{

t ← a[k];

a[k] ← a[i];

a[i] ← t;

RKU(a, k+1, n);

t ← a[k];

a[k] ← a[i];

a[i] ← t;

}

}
in DS retagged by
141 views

Please log in or register to answer this question.