- Understand algorithms (written in pseudocode or flow diagram), explain what they do, and correct or complete them
- Produce algorithms in pseudocode or flow diagrams to solve problems
Lesson 1: Theory (Flowcharts)
Suggested time: 50 mins
I started by showing students a clip from an episode of the Big Bang Theory in which Sheldon shows his friendship algorithm in the form of a flowchart. (Thanks to Phil Smith for suggesting this one via CAS)
I started by explaining that an algorithm is simply a sequence of steps for completing a task. I went on to explain that algorithms can be represented in many ways, the most commonly used being flow charts and pseudocode.
I followed this by going through an example on the board (see below).
I followed the introduction with two matching exercises which I downloaded from clickschool.co.uk - see below (requires flash).
In the first matching exercise, students had to match the flowchart symbols to their names. In the second exercise, students were challenged to complete a given flowchart by placing the events in the correct order.
With input from the students, I went through the solution to the second matching exercise - “going to school”. I then asked the students to suggest what daily routines were missing from the example.
Students were then placed into small groups and asked to improve the algorithm for getting up and going to school in the morning (in the form of a flowchart).
Tip: You can get the students to write down any algorithm (e.g. making the tea, tying a shoelace, making a jam sandwich etc.) however, I find, the more complex the algorithm, the easier it is to explain the need for sub-routines later in the lesson. The going to school algorithm is great for demonstrating this as you can have several sub-routines for brushing your teeth, taking a shower, making breakfast etc. Also, try to encourage your students to make their algorithms as detailed as possible - this will also help with explaining the need for sub-routines later.
Whilst the students were busy creating their flowcharts, I wandered around the classroom and picked out the group with most complex solution. I then invited that group to replicate their flowchart on the whiteboard and explain their solution to the rest of the class. As the group explained their solution, with the aid of the class, I corrected any errors and highlighted any misconceptions.
I waited for the group to fill the whiteboard, at which point I stopped them and asked the rest of the class to suggest how the group could simplify / clean up their flowchart. This is where I introduced the flowchart symbol for sub-routines (see below).
I asked the students to suggest the possible benefits of using sub-routines and waited for answers such as “easier to understand” and “several people can work on the same algorithm at the same time”. I finished by asking the students to modify their solutions to include at least one sub-routine.
The friendship algorithm - Clip from an episode of the Big Bang Theory in which Sheldon shows his friendship algorithm in the form of a flowchart.
BBC Byte Size (System Flowcharts)
Algorithms in pseudocode and flow diagrams - Lesson plan on algorithms in pseudocode and flow diagrams.
Algorithms in pseudocode and flow diagrams - This video, presented by Clive Beale of the Raspberry Pi Foundation, looks at good practice in the techniques of writing pseudocode and producing flow diagrams.
There are several ways in which you can introduce flowcharts. Here are some alternatives to the ones I suggested:
1. Jam Sandwich activity.
In this exercise, students are asked to create an algorithm from set commands to program their teacher (sandwich bot) to make a jam sandwich. Students must write a set of working instructions, using commands such as Pick Up and Put Down, which their teacher has to follow precisely in order to make a jam sandwich. This task can be easily adapted to incorporate flowcharts and is great for introducing algorithms (at any age)! To find out more, check out this lesson plan, courtesy of Phil Bagge, CAS Primary Master Teacher (@baggiepr): Jam Sandwich Algorithm (programming teacher bot)
2. Making the tea starter.
This is a starter activity I use to introduce algorithms. Print and cut out the attached instructions for making a cup of tea. Instruct students to put the instructions in the correct order. The “Making the Tea” exercise has been doing the rounds for sometime. I remember doing it at college back in the early 90’s. What I find interesting is seeing all the different variations for such as simple task. Extension task: If your students are feeling really confident, you could challenge them to create a BS 6008 compliant algorithm for making the tea!
Here are a set of Flowchart tasks for simple activities (making tea, coffee, pizza, lasagna etc.) courtesy of David Barnard (via CAS). Includes a differentiated version of the making tea exercise. (Requires you to login to the CAS community - FREE)