# KS2 Algorithms

Children in Key Stage Two can develop their understanding of computing, using a range of resources to meet the new National Curriculum Objectives for algorithms, including using logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs.

### 2D Shape Drawings Activity: an Introduction to Debugging Algorithms

This activity goes deeper into the concept of algorithms, using logical reasoning and debugging to find errors and to improve accuracy and efficiency.

By following instructions, students create diagrams constructed from simple shapes. They are asked to identify errors in the instructions, akin to debugging an algorithm. They then create their own algorithm and introduce their own errors - a partner is then asked to debug it by examining the output while following the commands.

An extension activity that asks more able learners to identify patterns is included, as are opportunities for formal or informal assessment. Teaching notes also reference the Barefoot Computing concept cards.

### Logical Number Sequences Activity

Combining maths and computational thinking, this Barefoot Computing activity for upper primary uses linear number sequences to introduce algorithms in computing.

Students work collaboratively to apply logical thinking and pattern recognition - key concepts used across the Barefoot Computing project. While using arithmetic skills to solve number-pattern challenges, they are encouraged to explain their reasoning and methods for working as well as to find the numerical answers. The activity encourages perseverance and teamwork.

### Patterns Unplugged: Reusing Recipes Activity

This 'unplugged' activity introduces pattern recognition and the idea that algorithms can be repurposed.

Cooking recipes are analysed to find parts that are common to more than one. Reusable parts are then borrowed to create new recipes which the students share with the class.

Additional teacher guidance is given, covering assessment, differentiation, and curriculum links.

### Get It Sorted

This activity initially investigates and compares two sorting algorithms – bubble sorts and quick sorts – via physical activities. The activity then introduces a simple sorting network and a comparison is performed to see which is the quickest of the three methods to sort a set of 6 numbers. This is an off-line (unplugged) resource and requires little set up and can be run in small groups or as a class.

### Tower of Hanoi

This is an example of the famous mathematical puzzle which consists of attempting to move all the disks from the leftmost peg to the rightmost peg. Adhering to the simple rules that only one disk can be moved at a time, a larger disk may not be placed on top of a smaller disk and only one disk can be moved at a time.

This version is an interactive version which shows the most efficient way of solving the problem. It would be better if the students had a go first to solve the problem using another online version (https://www.mathsisfun.com/games/towerofhanoi.html).

The activity is followed by questions that get the students to try and create algorithms for solving the problem with different numbers of starting disks. The students complete the activity by using their mathematical knowledge to create a general formula for the least number of moves to complete the challenge.

### Real-life algorithms: paper airplanes

A lesson plan that takes the students through the algorithm to making a paper airplane. It consists mainly of a worksheet task to correctly sequence the steps in making a paper airplane, in doing so they must discard any superfluous information. The idea is then that they give their algorithm to another child for that child to follow in making an airplane.

### Real-life algorithms: plant a seed

A lesson plan that takes the students through the algorithm to plant a seed. It consists mainly of a worksheet task to correctly sequence the steps in planting a seed, in doing so they must discard any superfluous information. The idea is then that they give their algorithm to another child for that child to follow in planting a real seed. This activity has strong cross curriculum links to science.

### Lightbot

Lightbot is an educational game for students that introduces several principles of programming. Students will practice concepts like sequence, conditions, and loops without typing or coding and this will extend their problem-solving skills as they complete the puzzles.

**Resources**

- Teacher guide as to how Lightbot teaching programming
- Basic Programming Guide
- Solutions to 2015 Hour of Code problems
- Printable Lightbot Icons for unplugged activities

### The Intelligent Piece of Paper

In this activity from the CS4FN team, learners are introduced to algorithms in the context of artificial intelligence. They are challenged to beat a ‘piece of paper’ at a game of noughts and crosses. By following a simple algorithm, the piece of paper becomes very difficult to beat. The algorithm is a sequence of steps, with decisions made based on the current game state using IF statements. The resource would be well suited for use as a starter activity. Everything needed to run the activity as a front-of-class demo is included.

### Computational thinking

A comprehensive guide taken from the Quickstart guide to what computational thinking is and what it might look like in the primary classroom. It involves classroom activities which include (amongst others):

- Writing algorithms and looking for patterns (generalisations) in comparison to other students’ algorithms.
- Looking for abstractions and generalisations in designs used in other curriculum areas such as design and technology or music.
- Logical reasoning by making predictions for what a computer program will do or to explain school rules.
- Evaluating why one algorithm may be better than another one.
- Exploring decomposition by taking apart a computer or breaking a large-scale computer program into more manageable parts.

### Puzzles

Logic is a fundamental computational thinking skill for children to master and apply, supporting computing, maths, science, and many STEM subjects. These unplugged activities, offer creative, thought provoking tasks for pupils to test their logic with a combination of eight different puzzles and riddles for pupils to try.