Recursion Diagram for Hanoi1 Example with 3 Disks Let hnABC be an abbreviation for hanoi(n, "A", "B", "C"). The output always comes between the first (left) recursive and second (right) recursive calls. Recursion Tree h3ABC _________/ \_________ | AtoB | h2ACB h2CBA ___/AtoC \___ ___/CtoB \___ | | | | h1ABC h1BCA h1CAB h1ABC /AtoB \ /BtoC \ /CtoA \ /AtoB \ h0ACB h0CBA h0BAC h0ACB h0CBA h0BAC h0ACB h0CBA Sequence of Activatations, Terminations and Outputs h3ABC Activated h2ACB Activated h1ABC Activated h0ACB Activated h0ACB Terminated Output A to B h0CBA Activated h0CBA Terminated h1ABC Terminated Output A to C h1BCA Activated h0BAC Activated h0BAC Terminated Output B to C h0ACB Activated h0ACB Terminated h1BCA Terminated h2ACB Terminated Output A to B h2CBA Activated h1CAB Activated h0CBA Activated h0CBA Terminated Output C to A h0CBA Activated h0CBA Terminated h1CAB Terminated Output C to B h1ABC Activated h0ACB Activated h0ACB Terminated Output A to B h0CBA Activated h0CBA Terminated h1ABC Terminated h2CBA Terminated h3ABC Terminated