Problem with recursion? (was [plt-scheme] Re: Novice needs help writing function )

From: jerzy.karczmarczuk at info.unicaen.fr (jerzy.karczmarczuk at info.unicaen.fr)
Date: Fri Jan 4 14:15:29 EST 2008

Yavuz Arkun writes: 

> When I am trying to understand a program, I put myself in the place of the 
> computer and work through the program in my mind. 

Sorry to be a bit nasty once more, but this attitude - even if it works
for you - should be absolutely screened from students, especially newbies.
They should grasp the meaning, and if it can be done in a stateless, static
way, the better. Your technique is pedagogically murderous! My goodness,
squeezing students heads into computers...
And what do you mean by that?: assembler? Surely you don't reduce yourself
to the dataflow of binary impulses through electronic gates! At what level
you *should* stop?? 

> Therefore, recursion (like any other method) should be illustrated using 
> examples that can be best solved with recursion.

Yessir. And there are plenty of.
Not necessarily linear. I had a programming course to high-school pupils
(not in school, but a club, so they were all specifically motivated), and
I had no real problems. 

* Towers of Hanoi/Benares. Try to do it iteratively.
* Generation of all permutations. The same comment. 

Notice that the first and the second example are very different, the first
reduces, the second extrapolates, moreover needs such data as lists, but
this is OK. 

* Quicksort.
* Generating of some functions known to them, such as sin(x) through the
 triplication algorithm.
* Power x^n through the binary splitting of the exponent. 

==
The point is, my dear fellows, NOT the teaching of those concepts to
newbies. The problem is with convincing their teachers to do it early, and
this should begin with putting more brains into heads of people who teach
teachers! 

I have still around me some physicists who feel entitled to teach
programming to physics students (and who do it), and who shrug, saying that
comp. sci. teachers nearby are useless, since they teach such stupidities
as recursion, without any relation to real physics examples.
But I ask usually then how do they teach Fast Fourier, and we have a good
laugh. 


Jerzy Karczmarczuk 




Posted on the users mailing list.