title: Tower of Hanoi Call Trace
body: <p>I was studying tower of hanoi recursive implementation in python. In my prgram I gave print at different points to know it better like</p>
  
  <pre><code>def hanoi(n, src, inm, dest):
      print "n=",n,"src=",src,"inm=",inm,"dest=",dest
      if n == 0:
          return
      hanoi(n-1, src, dest, inm)
      print src, '-&gt;', dest
      print n 
      hanoi(n-1, inm, src, dest)
  
  hanoi(2,'A','B','C')
  </code></pre>
  
  <p>The answer is printed like:</p>
  
  <pre><code>n= 2 src= A inm= B dest= C
  n= 1 src= A inm= C dest= B
  n= 0 src= A inm= B dest= C
  A -&gt; B
  1
  n= 0 src= C inm= A dest= B
  A -&gt; C
  2
  n= 1 src= B inm= A dest= C
  n= 0 src= B inm= C dest= A
  B -&gt; C
  1
  n= 0 src= A inm= B dest= C
  </code></pre>
  
  <p>I could understand upto</p>
  
  <pre><code>   1
      n= 0 src= C inm= A dest= B
  </code></pre>
  
  <p>I couldnt understand how A -> C is printed after this. After the call with  n= 0 src= A inm= B dest= C, I know function will be returned. There the active function is n= 1 src= A inm= C dest= B. What happens to that? </p>
  
  <p>Please explain the trace</p>