void function(int A[], int i, int j){
if (j == i+1)
if (A[i] > A[j])
swap(A,i,j)
else {
int k = (j-i+1)/3;
function(A,i,j-k);
function(A,i+k,j);
function(A,i,j-k);
}
}
This piece of code is taken from a past mid-term exam in my Analysis of algorithms class. It was asked of the students to derive a recurrence relation that describes the behaviour of this function. I've seen a few examples on the internet on how this process is done, but I just can't figure out how to apply it on this particular function, the i and j indexes are really confusing to me.
Any ideas?