Using graphical examples to motivate the study of recursion

  • Authors:
  • Ben Stephenson

  • Affiliations:
  • University of Calgary, Calgary, Alberta, Canada

  • Venue:
  • Journal of Computing Sciences in Colleges
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recursion is an important part of a complete computer science education. It is a topic that is often introduced during the first course, and then revisited when tree data structures are introduced and functional languages are discussed. Because recursion is introduced early in the curriculum, the range of problems that can be discussed when it is first encountered is limited. In particular, because students generally haven't been introduced to data structures like trees or efficient sorting algorithms such as quick sort and merge sort, these areas which use recursion to elegantly solve important problems can't be used to motivate its study. This paper describes three graphical problems which can be used to motivate the study of recursion. Each of the examples demonstrates the utility of recursion while being appropriate for students nearing the end of their first term in a computer science course. In particular, these examples can be understood and implemented by students who have a reasonable understanding of loops, function calls, and, for some problems, arrays. They do not require any knowledge of object oriented design, pointers or complex data structures. Furthermore, while iterative solutions exist for each of the problems that we describe, the iterative solution for each problem is more complex than its recursive solution. We believe that this is an additional strength of these examples because it helps convince students that recursion is a tool that will allow them solve some problems more easily.