top of page

Some Ideas on How to Teach Algorithms and Sorting Algorithms

Here is a list of resources, lessons, ideas and videos of different ways to teach and introduce algoritms, focusing on sorting algorithms (without code).

 

This would be good for a grade 9 or 10 introductory course where computer science and coding are still generally new. I would do an introduction to algorithms early in the course and then sorting later on, after they have interacted with coding some. 

 

The idea of algorithms is sometimes confusing for students because it sounds mathematical; they have a hard time understanding it as a process of steps to solve a problem, as that sentence may seem elusive or vague. Additionally, sorting can be difficult to comprehend because it involves a level of metacognition as students need to reflect on and examine a process (sorting) that generally comes naturally to them in order to make sense of the steps. 

 

Generally, sorting might be taught by gradually sorting a set of numbers numerically following the specified algorithm. Rather than doing this, it might be useful to teach algorithms as a concept that can be transferred into real life situations (such as making a sandwhich, or checking your social media) and then using varying real life data to demonstrate sorting. Other examples could be checking a phone book or dictionary, but do kids still do that? 

 

This approach would be useful because students can see a variety of uses for sorting, as well as view algorithms as a process of steps rather than as a mathematical procedure. This also scaffolds students understanding of these sorts because it allows them to focus on the steps and comparisions rather than trying to comprehend the data. However, I will note that some of these ideas can be seen as somewhat juvenile and should be used to introduce an idea, not teach it; moving from these activities into whatever language that is being used should be swift and basically immediate. 

 

As far as assessment goes, I would do a real fun quiz where students would have to describe the general idea of each sort we cover so that I would know if they fully understand the differences and that they can distingush the comparisions before moving forward with the coding aspect of it. 

 

Formative assessment would probably translate over into the coding sections. After each sort and quiz, I could demonstrate the steps by collaboratively writing lines of code in whatever program or language that is being used. This would then probably filter into their project designs, where some type of sorting would have to occur (allowing them the choice of type of sort and data to be sorted, based on their project).

 

Assessment can also travel into the earlier areas of Kodu or Scratch, where students have to explain the algorithm alongside the code they write/the game they create. 

Sorting Algorithms
 
Idea: 
- Purpose: To introduce the idea that there are different types of sorts.

- Give each student a set of ~10 cards from a deck and ask them to sort them; however, students must document each step that they take as they go through the sorting process. For example, if they search the deck for the highest card first, they will write that is their first step. If they first place the first card down and plan to sort the others around it, that would be there first step. 

- After each student has sorted their stack and documented their process (should not take very long at all), do an informal poll; who found the highest card first? Lowest? Who organized them one by one? Etc. Identify each process by there algorithm term: selection, insertion, quick, etc.

 

Idea:

- Purpose: To teach selection sort without code.

- Briefly outline the steps of a selection sort.

- Get students to stand, and assign one student to orchastrate the steps of a selection sort to organize the other students by their birthdays. 

- Get students to describe the process. 

 

Idea:

- Purpose: To teach quicksort without code.

- Similar to the selection sort, but use height, or middle name alphabetical, or any personalized data, rather than birthdays. 

 

Idea:

- Pupose: To teach the time cost of different types of sort in comparision to each other.

- Have the students chose which sorting algorithm they think is going to be most efficient in sorting out a set of weights and document and justify their choice (by ballot or online poll so their choice is not influenced by their peers). 

- Create teams: each team will be one type of sorting algorithm. The goal is to see which team averages better in sorting the exact same data over multiple tests.

- Using weights (csunplugged.org, csunplugged.org), teams would go in turn and sort their data according to the steps of their teams algorithm. They would be timed/comparisions would be counted and averaged out at the end. 

- The students who had correctly guessed the winning team would recieve a "prize" (bonus marks?), rather than the winning team.

 

Resources:

csunplugged.org

csunplugged sorting

Hour of Code

intro to algorithms

RAPTOR

youtube tutorials using RAPTOR

 

Videos using folk dance:

Selection sort

Quicksort

Merge sort 

Bubble sort

 

Video Teaching Algorithms with the Big Bang Theory:

 

 

Introducing Algorithms: 
 

Preperation/requirements: learn to solve a standard 3x3 rubik's cube. Possible tutorial here. It's possible to solve one in around 1 minute fairly easily. Have 3 cubes avaible to you.

 

- Purpose: To introduce students algorithms and how they work.

- Give three different students a cube and ask them to mix it up. Then get one student to compare the three to ensure they are all mixed up differently. 

- Ask students for the definition of algorithms, provide it, ask for some every day examples of them, provide some examples (the steps you take when making a grilled cheese sandwich, the process you go through when checking Facebook on your cell phone, the route you take when walking to school, etc.) - all while solving the three cubes. 

- Ask students how I solved it. What techniques do they think I used? (Hopefully they say algorithms) Did I use the same algorithms for each cube, even though they were mixed up differently? (Yes) Can anyone learn? (Yes) 

- Mini lesson on the cubes algorithms or show a video of the cubes solutions.

- Move from the cube into real life examples of algorithms and formal definitions of the steps and processes involved.

 

Other Ideas: 

- Use Kodu to show the steps of game development as an algorithmic example.

- Use Scratch or Alice as an example of how lines of code/steps work together to solve a problem/do a thing.

- Have students document each step of certain tasks (i.e. putting their clean laundry away).

- Take an example and show the code version of it (alphabetizing names could be a good example).

- Using RAPTOR to teach algorithms through flow charts. This would work well if paralleled with coding; each new concept can be explained through developing a flow chart before transfering the concept into a computing language. Not the most exciting approach, but extremely effective for visualizing the process. 

 

bottom of page