title: A good method to manually trace a recursive function with several variables
body: <p>For claritys sake: This is a question related to a upcomming exam, but I think the answare could be of interest for a larger group.</p>
  
  <p>I need to trace code similar to the one below which has components such as recursion, passing and rearranging of arrays and more than one variable passed to the recursive function.</p>
  
  <p>What is the best method to do such a trace manualy? 
  My main problem with the methods I have seen is that there are so many variables to keep track of. That makes methods useing trees of the function calls really messy in no time. Is there a good way of tracing it with a combination of tables and trees?</p>
  
  <h2>Example code</h2>
  
  <pre><code>function f(array A, int i, int j)
  repeat while i!= j
  int m = (i+j)/2;
  f(A, i, m);
  f(A, m+1, j);
  if (A[m] &lt; A[j]) swap(A[m], A[j]);
  j = j - 1
  done
  end;
  </code></pre>