A gentle introduction to mutual recursion

  • Authors:
  • Manuel Rubio-Sánchez;Jaime Urquiza-Fuentes;Cristóbal Pareja-Flores

  • Affiliations:
  • Universidad Rey Juan Carlos, Madrid, Spain;Universidad Rey Juan Carlos, Madrid, Spain;Universidad Complutense de Madrid, Madrid, Spain

  • Venue:
  • Proceedings of the 13th annual conference on Innovation and technology in computer science education
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recursion is an important topic in computer science curricula. It is related to the acquisition of competences regarding problem decomposition, functional abstraction and the concept of induction. In comparison with direct recursion, mutual recursion is considered to be more complex. Consequently, it is generally addressed superficially in CS1/2 programming courses and textbooks. We show that, when a problem is approached appropriately, not only can mutual recursion be a powerful tool, but it can also be easy to understand and fun. This paper provides several intuitive and attractive algorithms that rely on mutual recursion, and which have been designed to help strengthen students' ability to decompose problems and apply induction. Furthermore, we show that a solution based on mutual recursion may be easier to design, prove and comprehend than other solutions based on direct recursion. We have evaluated the use of these algorithms while teaching recursion concepts. Results suggest that mutual recursion, in comparison with other types of recursion, is not as hard as it seems when: (1) determining the result of a (mathematical) function call, and, most importantly, (2) designing algorithms for solving simple problems.