When I teach recursion in CS2, I start with all the traditional examples that appear in most textbooks: the exponential function, the factorial function, the Towers of Hanoi, and so on. Towards the end of the lesson, I feel the need to apologize to them for offering such trivial examples. By way of apology, and of explanation, I tell them this old story:
A police officer sees a drunken man intently searching the ground near a lamppost and asks him the goal of his quest. The inebriate replies that he is looking for his car keys, and the officer helps for a few minutes without success then he asks whether the man is certain that he dropped the keys near the lamppost.
"No," is the reply, "I lost the keys somewhere across the street." "Why look here?" asks the surprised and irritated officer. "The light is much better here," the intoxicated man responds with aplomb. 
And so, I explain that, yes, these simple examples could be done more simply with iteration, but that more difficult examples will come later (like binary search trees), and practicing the technique "where the light is better" will make that transition easier.
I wonder if I should stop apologizing.
It seems my whole educational life has been filled with exercises that I completed not because the answer was important, but because the journey to the answer was important. I practiced Bach Inventions at my piano to learn dexterity and technique, not because the Inventions are particularly beautiful works. I performed experiments in my chemistry class to calculate Avogadro's number to learn the scientific method, even though its value is well known. I learned how to prove the Pythagorean Theorem to learn how to construct a mathematical proof, not because anyone is in doubt regarding the theorem's reliability.
When I enter the classroom, I feel pressured to demonstrate the relevance of our discipline to my students. And so, I strive to find assignments that demonstrate the wonders of our discipline while remaining accessible to novitiates. But maybe it's okay, occasionally, to let our students know that we're giving them an exercise whose purpose is to help them hone their skills. There's plenty of room for letting students practice how to average a list of numbers , even as we get them ready for something more "nifty" .
Sometimes, it's okay to search where the light is better. It'll help us learn how to search in poor light, too.
2. O'Toole, G. "Did You Lose the Keys Here?" "No, But the Light Is Much Better Here." Quote Investigator, http://quoteinvestigator.com/2013/04/11/better-light/. Accessed 2017 March 30.
3. Parlante, N., Nifty Assignments: http://nifty.stanford.edu. Accessed 2017 March 30.
James K. Huggins
Computer Science Department
1700 University Avenue
Flint, MI, USA
Copyright held by author.
The Digital Library is published by the Association for Computing Machinery. Copyright © 2017 ACM, Inc.Contents available in PDF
View Full Citation and Bibliometrics in the ACM DL.
To comment you must create or log in with your ACM account.