Presentation is loading. Please wait.

Presentation is loading. Please wait.

Carol Zander University of Washington, Bothell presents Recursion.

Similar presentations


Presentation on theme: "Carol Zander University of Washington, Bothell presents Recursion."— Presentation transcript:

1 Carol Zander University of Washington, Bothell presents Recursion

2 Background Virtues of active learning o Human Tableau (Angelo & Cross), students act out key ideas o Kinesthetic Learning (Begel, Garcia, Wolfman), physically engaging exercises o Active & Cooperative Learning (McConnell), face-to-face interaction and group process

3 Background Colleague was teaching recursion in a CS2-like course Allowed me to present a problem, solve it, and have the students simulate the run-time stack

4 The set-up

5 Problem Evaluate a prefix expression o valid expression o single digit operands o operators: + - * / Worked with / * + 9 3 – 4 2 + 5 1 which is (9+3)*(4-2)/(5+1)

6 Program int evaluate(index in array) { char symbol = expr[++index]; if (symbol is a an operand) return symbol as a digit; // symbol is an operator + int leftOperand = evaluate(index); int rightOperand = evaluate(index); switch (symbol) { case ‘+’: return leftOperand + rightOperand; case ‘-’: return leftOperand – rightOperand; case ‘*’: return leftOperand * rightOperand; case ‘/’: return leftOperand / rightOperand; default: break; }

7 The execution

8 Run-time stack Each student got an index card with one symbol from the prefix expression on it They were to use the board for the rest of the memory of the activation record 3 +

9 Run-time stack Idea was that they would form a human run-time stack Move around Pop off stack Push onto stack

10 The result

11 Anticipated an ah-ha moment... Instead it was an uh-oh moment Actual results were absolute, glorious, complete cluelessness! They had no idea what was going on

12 The following is a dramatization of the actual event. No students were actually clueless in the making of this presentation.

13

14

15

16 Such a shame that it was such a dismal failure because...

17 It seemed like a good idea at the time

18 Lessons Learned

19 Not a complete failure Besides learning to never try that active learning exercise...

20 Recursion is very complex for students. They must fully understand problem-solving recursively first. Executing recursive functions is so different from solving them...

21 Is it a chicken-and-egg problem? Perhaps a simple, linear recursive problem in class... Give the prefix problem for homework. Have them draw an execution tree. Good idea??


Download ppt "Carol Zander University of Washington, Bothell presents Recursion."

Similar presentations


Ads by Google