Hey, I want to draw the call stack for any recursive method, so I've created a schema like this,
recursiveMethod(){
//Break recursion condition
if(){
// Add value here to the return values' list- No drawing
return
}
else{
//Draw stack with the value which will be pushed to the stack here
variable <- recursiveMethod()
//Clear the drawing which represents the poped value from the stack here
return variable
}}
Applying the schema will look something like this,
Notes:
- This schema can draw recursive methods with n recursive call by making the recursive calls in a separate return statements.
- returnValues list, is a list which save all the return values, just for viewing issues.
- Draw stack means, simply Draw a simple cell "rectangle" + Drawing the pushed String.
What do you think of this? any suggestions are extremely welcomed.