# Comparing and contrasting algorithms is better than sequential presentation

In five days, I’ll be heading to ICER 2013 in San Diego, where I’ll be presenting a paper “Comparing and Contrasting Different Algorithms Leads to Increased Student Learning“ (pdf here).

The findings in a nutshell: if you present two different approaches to solving a compsci problem side-by-side and have students compare them, the students will understand the problem *better* than if you present those approaches sequentially. And importantly, the students will be better transferring their understanding of the problem to similar problems.

Why is this notable? Because the sequential approach is pretty much ~95% of how we teach algorithms and data structures! Just this past term when teaching CS2 I did things this way: a unit on binary trees, then a unit on BSTs, then a unit on heaps. Yet the evidence we have here is that it’s better to show algorithms/data structure variation in parallel.

### Background Knowledge

This study is a replication of two studies in math education – a study on algebra problems, and a fol]low-up study on estimation problems, both by Bethany Rittle-Johnson and Jon R. Star.

In the original algebra study, students were randomly assigned to one of two groups:

- a control group where students were given workbooks that had students saw a worked example solving a problem using one approach; they answered questions about it; then
*on the next page*they saw a second worked example solving the problem using a different approach, and answered questions about it an experimental group where the workbooks presented the two worked examples

*side-by-side*and students worked on all those problems*on the same page*

The study has a pretest-intervention-posttest model, where the pretest and posttest are the same test. This allows the researchers to see how much students learnt from the intervention. The tests probed three things:**procedural knowledge**– how to solve a problem***procedural flexibility**– being able to solve a problem with multiple approaches; being able to generate, recognize and evaluate different approaches**conceptual knowledge***And what did they find?*the compare & contrast group did

**better**than the sequential group with respect to__procedural knowledge__and__procedural flexibility__- the two groups
__did the same on conceptual knowledge__

The conceptual knowledge thing was a bit of a surprise to them.*So, they did another study!*This time, they did a prestest-intervention-posttest-followup study. That’s the same as before, but with a second posttest given some time after the study, to see how much students retain. In this study, the math problems were about estimation.

What did they find?

*Again*, the compare and contrast group did**better**on the posttest and the follow-up with regard to__procedural knowledge__and__procedural flexibility__But again, the two groups are the same on

__conceptual knowledge__.

It bothered them some more that the conceptual knowledge was different. Some similar studies in other fields would lead one to predict conceptual knowledge would be the same. So, they looked closer at their data:For the students who started off with

**some**conceptual knowledge, the compare & contrast condition lead to__more__learning.- For the students who had
**no**conceptual knowledge to begin with, it__didn’t matter__which condition they were given.They speculated that you need to have some existing knowledge of a problem for comparing and contrasting to really shine.

#### Our study

We ran our study as a pretest-intervention-posttest-followup study, following the estimation study. In our study, CS2 students compared different techniques for hashing. We ran the study in three different sections of CSC 148 at UToronto, with 241 students participating.

Not that surprisingly, students in the compare-and-contrast group performed better at procedural knowledge and procedural flexibility – and the two groups performed the same on conceptual knowledge.

But we found the *opposite* of Rittle-Johnson and Star when we looked closer at conceptual knowledge:

- students who started with _no_ conceptual knowledge gained
**more**from the compare-and-contrast condition than from the sequential condition - students who started with
*some*conceptual knowledge performed the**same**in both conditions

What we think is going on here is that the compare-and-contrast approach lets students build a schema.**By looking at what is different and similar, they can decipher what the important aspects of a problem are.**

For the students who already have such a schema in place, when they see things sequentially, they can relate things back to their schema. They already know what the important aspects of a problem are, and so can compare on the fly.

For an expert like me, or any other instructor, this is the same for us. When I look at a hash function, I already know the aspects of hashing that can be varied to solve problems differently. When I see something new presented, I can relate it back to what I already know.

Another difference comes with yardsticks. Experts work with yardsticks like big O notation and complexity classes – that allow us to scale up our knowledge very easily. For novices, it’s a lot easier to handle “mergesort is faster than selection sort” than “mergesort is O(nlgn)”.

For us experts, it makes sense to present information sequentially – because we can easily process things that way. For our students – the ones learning things completely afresh – **that’s a lot harder**.