retagged by
356 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;

}

}
retagged by

Please log in or register to answer this question.

Related questions

1 votes
1 votes
1 answer
3