Activity 01
Side-by-Side Analysis: Compare Implementations
Pairs write both recursive and iterative versions of the same function (Fibonacci, factorial, or list sum), then add instrumentation to measure memory usage and timing at input sizes n=10, 100, and 1000. Partners report their measurements and together draw conclusions about which approach is preferable and why.
Compare the memory and time complexity of recursive versus iterative solutions.
Facilitation TipDuring Side-by-Side Analysis, require students to highlight one line in each version that justifies its primary advantage so the comparison stays grounded in code.
What to look forPresent students with two code snippets solving the same problem, one recursive and one iterative. Ask them to identify which is which and write one sentence explaining the primary advantage of the iterative version for this specific problem, focusing on memory or performance.