Bug Infestation! A Goal-Plan Analysis of CS2 Students' Recursive Binary Tree Solutions
School of Computing and Information Systems
Padnos College of Engineering and Computing
A goal-plan analysis was conducted to examine the variety of plans students use in writing a recursive method for an operation on a binary search tree. Students were asked to write a recursive method to count the nodes in a binary search tree with exactly one child. The problem incorporated two goals: traversing the tree and counting nodes with one child. Three traversal plans and four counting plans were observed in student solutions. Over half of the students used the arms-length recursion plan, which involves testing for the base case before it is actually reached in order to avoid making recursive calls. This strategy creates complex and error prone code. Making students aware of arm's-length recursion may help them avoid introducing bugs into their recursive code. Although nearly all of the 18 participants demonstrated viable plans for solving the problem, their solutions contained a variety of errors: 55 total errors of 15 types. Students had particular difficulty with base cases, misplaced calculations, and missing method calls. Knowledge of these errors can be useful for instructors when developing lecture examples, identifying distractors for peer instruction multiple-choice questions and for designing homework exercises. Instructors can counteract these problems by providing a variety of recursive examples.
SIGCSE: Computer Science Education
Kansas City, MO
Grissom, Scott; Fitzgerald, Sue; Murphy, Laurie; and McCauley, Renee, "Bug Infestation! A Goal-Plan Analysis of CS2 Students' Recursive Binary Tree Solutions" (2015). Faculty Scholarly Dissemination Grants. 592.
This document is currently not available here.