Quora Feeds
Active Member
Shriram Krishnamurthi
I disagree with just about every answer written here. There are two reasons why people might answer "recursion", and each one needs more discussion.
But before I go on: I get many comments from people who assume I am somehow in the anti-recursion camp. On the contrary, I have been teaching recursion for over 20 years, and think most of the confusion about it is entirely artificial. To understand how I teach it, see Shriram Krishnamurthi's answer to How does professor Shriram Krishnamurthi teach the concept of recursion?.
Back to my answer to this question:
See Questions On Quora
Continue reading...
I disagree with just about every answer written here. There are two reasons why people might answer "recursion", and each one needs more discussion.
But before I go on: I get many comments from people who assume I am somehow in the anti-recursion camp. On the contrary, I have been teaching recursion for over 20 years, and think most of the confusion about it is entirely artificial. To understand how I teach it, see Shriram Krishnamurthi's answer to How does professor Shriram Krishnamurthi teach the concept of recursion?.
Back to my answer to this question:
- Our basic pedagogy of recursion is broken. Were you taught fibonacci or factorial first? If so, you were taught the two worst examples of recursion one can imagine—both should be banned from CS education. In contrast, our book How to Design Programs teaches you to begin from structural recursion. Why? Because structural recursion follows from the structure of the data. It is amazingly natural. Only after you've mastered structural recursion do we teach generative recursion, which requires you to invent recursive structures.
- This problem of pedagogy is compounded by two things instructors do:
- Teach loops before recursion (thanks for reminding me, Jesse Tov). Therefore, one is made to look more basic than the other.
- Push recursion to a second course, as an “advanced” concept. Then teach it with a great deal of Sturm und Drang.
- Unlike loops, recursion expands. You can recur over linear data, but you can also recur over non-linear data. You can recur structurally or generatively. With enough recursion you can even generate new control structures such as state machines (e.g., Automata via Macros). You can't do any of this with loops.
See Questions On Quora
Continue reading...