University of Cincinnati logo and link
 
Box Trace
 
  UC ingot 
The box trace can help you understand how a recursive call works.
  • Label each recursive call in the body of the recursive method.
  • Represent each call to the method by a new box in which you note the method’s local environment. Each box will contain:
    • The values of the references and primitive types of the method’s arguments.
    • The method’s local variables
    • A placeholder for the value returned by each recursive call from the current box.
    • The value of the method itself.
    • When you first create a box, you will know only the values of the input arguments. Fill in the values of the other items as you determine them from the method’s execution.
  • Draw an arrow from the statement that initiates the recursive process to the first box.
  • After you create the new box and arrow, start executing them body of the method.
  • On exiting the method, cross off the current box and follow its arrow back to the box that called the method.



Home