A few points about the recursion mastery factor

The question of the recursion mastery factor has cropped up a few times on the IBO computer science forum and if you are considering incorporating it into your dossier you need to bear these points in mind:

  • Don’t include recursion unless it is appropriate. It should be used for quicksort, or for binary tree traversal, and that is about it. If you have any other use in mind, please ask me first.
  • Don’t use recursion to implement a while loop, eg to keep asking the user for input until they type ‘x’. This is inappropriate and can actually cause a stack overflow.
  • Don’t use recursion where an iterative method would be easier. The whole point of recursion is that it can provide very elegant solutions to what would otherwise be quite complicated procedures. If you don’t believe me, try traversing a binary tree iteratively.
  • Even if you do use it for sorting, make sure that ‘sortability’ is a success criterion. Otherwise it can look like you’ve only included a sort to gain the mastery factor, and that is not really the point.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s