Sitemap
Computing Macroxela

Computing Macroxela

Computer Science educator, programmer, & algorithm enthusiast who loves explaining interesting CS/Math topics and pedagogy

Sorting Algorithms via Cards

3 min readSep 10, 2025

Want to teach your students sorting algorithms in a way they can understand? Here’s a good activity to introduce sorting algorithms in way most students can understand without watering down too much or removing the core ideas behind the algorithms.

Assign students to pairs or groups of three and give each group a set of cards (preferably 10 or more). Any cards are fine as long as they have distinct numbers or letters that can be placed in numerical/alphabetical order. Starting with 5 cards, let students come up with instructions on how to sort them. The instructions can be in pseudocode or English sentences. They’ll write down the instructions and test it out with the cards shuffled in a different order as well as adding more cards after a few tries. As they test their algorithms, they should record how many steps it takes to sort a certain number of cards. This can be done through the table shown below.

Press enter or click to view image in full size

Once their algorithms have been tested a few times, make them exchange instructions with other groups so they can try it out. Just make sure that each group has a different algorithm than the one they developed. Then they repeat what they previously did with their own algorithm, sort the cards with the new instructions and record them in the table above. Groups can exchange instructions a few more times to get an idea of what others did. How many exchanges occur depends on the time available in class but they should exchange at least once.

After testing out other group’s algorithms, show the following videos: merge sort, bubble sort, and insertion sort. When watching the videos, students should try to write the instructions for the algorithms they see. They will probably all have different instructions but that’s fine. They simply need to be able to follow along. Once they’ve seen all three videos, let them try out the algorithms with their cards. Just like they did with their own algorithms, they will record the number of steps on a table like the previous one.

Get Computing Macroxela’s stories in your inbox

Join Medium for free to get updates from this writer.

After testing out the algorithms, answer the following questions.

  • Which algorithm resulted in the fewest number of steps on average? Why do you think that is?
  • How does your algorithm differ from the ones in the videos? How are they similar?
  • Based on the numbers in your table, which algorithm will take fewer steps when sorting 20 cards? 50 cards?

As they answer the questions, you can show on the board or screen the pseudocode for each sorting algorithm. Allow the students to compare the pseudocode to what they derived from the videos. Also let them try it out with their cards if it differs from their own instructions.

What does this lesson achieve? It introduces sorting algorithms without relying too much on the math behind it. Students don’t need to use any complex formulas or proof techniques to see what is going on. However, it still helps students build an intuition about how they behave. From the numbers in the table they can realize bubble sort tends to be the slowest one with insertion sort not far behind. They may realize there’s something powerful about how merge sort works which is a good way to introduce divide and conquer algorithms. The table also gives them a brief taste of what computational complexity (runtime of an algorithm) is in a grounded way. Without understanding computational complexity, choosing a good algorithm becomes a much more difficult task.

Many of the tasks require using the higher levels of Bloom’s taxonomy. Students need to create an algorithm based on current knowledge and knowledge gained from observations. They need to analyze different algorithms and apply them. Then they need to evaluate the results to understand how the algorithms work. Instead of relying on the teacher explaining how sorting algorithms work, they get to interact with them and internalize what they learn through their own experiences. As a follow-up assignment they can code the algorithms on a computer and test them with even larger sequences. That’s more effective than simply showing them how sorting works and asking them to code it afterwards. The coding should be easier after this activity since they already have a basic idea of how the algorithms work. Students learn not just coding skills but also general programming and algorithm skills that can be applied outside of a coding context.

--

--

Computing Macroxela
Computing Macroxela

Written by Computing Macroxela

Computer Science educator, programmer, & algorithm enthusiast who loves explaining interesting CS/Math topics and pedagogy