Stack Simulation
A visualization of the recursive stack

Context

A stack simulation is provided alongside an IDE interface allowing the visualization of a solution to a specific set of recursion-based problems. These problems include: Factorial, Power, Square and Tree traversal. The simulation aims to facilitate the learning experience and provide a more intuitive understanding recursion.

WHY SIMULATE THE STACK?

One of the most important aspects of recursive programming that needs to be considered and understood is the role of the stack. The stack is a LIFO (Last In First Out) data structure, that is, it retrieves information in the reverse order that it was stored in. It stores the recursive functions’ parameters and local variables at the time it is called and thus saves the state of the function at the specific point during which it was executed.

Many students fail to understand the “active” and “passive” flow of recursion and the use of the stack for backtracking. A visual representation of the stack aims to clarify this.

partners

Questions

4 basic recursive questions are used:

img02

Factorial

img02

Recursive Power

img02

Recursive Square

img02

Post Order Tree Traversal

partners

RESULTS

In an evaluation of 20 students, the usability of the text editor interface had a mostly positive response. Almost 90% of students claimed it was easy to use to type their own code.

In terms of their interaction with the simulation itself, the simple block style of the simulation was a positive aspect.

Overall, 80% of students claimed the software to be extremely helpful in supplementing their understanding of recursion and the stack. These student’s claimed that such software would have been useful to have when they first started learning recursion as it demystified the concept of the call stack which they claimed was not easily grasped.

Resources

Stack Simulation: Literature Review

Literature Review

An investigation of a game generator tool to teach recursion

Stack Simulation: Final Paper

Final Paper

Developing a stack simulator

img02

UML Diagrams

Design documentation