This is a more complex example of the technique presented in Recursive method tracing. This example assumes familiarity with the previous example, including the notation used in the step by step trace.

Recursive method tracing example with nested calls

What does mystery(45) return?

public static int mystery(int value)
    if(value <= 10)
        return value * 3;
    return value + mystery(mystery(value / 5));

See the step by step trace with nested calls.

The same trace is available with each step on its own page, starting with Step 1.

Video of method above being traced

The video below shows the method being traced with each step narrated. The technique is the same as the text based version linked from this page.

Both links are to the same video. The YouTube verison might show ads (YouTube’s, not mine). The Google Drive version should not show ads.

Additional recursion resources


Comment on Tracing recursive methods