Coding Algorithms
Summary
Materials
Instructional Activities and Classroom Assessments
- Where are Algorithms Used? (10 minutes)
- Sorting Steps Group Activity (15 minutes)
- Code an Algorithm Using MakeCode Arcade (25 minutes)
- Extension Activity
Learning Objectives
- AAP-2.A Express an algorithm that uses sequencing without using a programming language.β2.A
- AAP-2.B Represent a step-by-step algorithmic process using sequential code statements. 2.B
- AAP-2.M For algorithms:
a. Create algorithms.β2.A b. Combine and modify existing algorithms.β2.B
Essential Knowledge
- AAP-2.A.1 An algorithm is a finite set of instructions that accomplish a specific task.
- AAP-2.B.1 Sequencing is the application of each step of an algorithm in the order in which the code statements are given.
- AAP-2.L.1 Algorithms can be written in different ways and still accomplish the same tasks.
- AAP-2.L.2 Algorithms that appear similar can yield different side effects or results.
- AAP-2.M.1 Algorithms can be created from an idea, by combining existing algorithms, or by modifying existing algorithms.
- AAP-2.M.2
Details
0. Before class
- In class, students will work in small groups to organize an out-of-order algorithm into the proper order. There are two options - converting decimal to binary and writing an essay.
- Decide if you want all students to work on the same example, or if you want them to work on different examples.
- Print the Binary and Essay Algorithm Steps for Cutting Out document so that you have enough for small groups of 3 to work together (Ex: If you have 24 students, and you are only plan to use the decimal to binary example, you will need to print 8 copies of the first page. If you plan to use both examples, you will need to print 4 copies of the document.)
- Cut out the steps so that they are in strips.
- Mix up the order of the strips for each group so they will have to decide on the proper order.
1. Where are algorithms used? (10 minutes)
- Discuss homework/reflection:
- How do algorithms affect our daily lives?
- Our society?
- Encourage students to share an algorithm that exists in society (culture, productivity, medicine, science, climate, transportation, etc.).
- Ask students to share what they discovered in their research.
2. Sorting steps group activity (15 minutes)
- Ask students to explain what algorithms are.
- Step-by-step instructions to complete a task or solve a problem.
- Ask students if they recall the three type of constructs used in algorithm implementations:
- Sequencing
- Selection
- Iteration
- Organize students into groups of three.
- You can use the Group Generator program to randomly sort students.
- Hand out the cut out steps for the binary and/or essay algorithm.
- Ask student groups to take the strips in front of them and organize them in the proper order.
- Give students five minutes to complete the task.
- When students are finished, ask student groups to share their steps with another group that had the same task:
- Students should compare their algorithms to see if there are any differences.
- If there are differences, do they reach the same result?
- Do they look similar, but yield different side effects or results?
- Ask students to identify the types of algorithm implementations present in the steps they organized.
3. Code an Algorithm using MakeCode Arcade (25 minutes)
- Discuss how knowing about existing algorithms can help in constructing new ones.
- Students will learn about two types of algorithms by examining existing code:
- An algorithm determining the maximum and minimum value of two or more numbers.
- An algorithm identifying if an integer is or is not evenly divisible by another integer.
- Then, as a class, you will code a variation of the algorithms students wrote yesterday to add ages in the room one after another:
- Review MakeCode Arcade interface.
- Lead students through basic blocks used to code their algorithm using the instructions on the slide deck.
- When you are finished creating the code, encourage students to save their work at this point.
- They can do this by create a Link to their programβ―with the Share button.
- If you are using a OneNote notebook with students, encourage students to copy and paste their program link to the Mathematical Algorithms page in the cell by the "Computing the sum or average of two or more numbers" cell.
- Alternately, they can download their programs as .png files on their local computers or on a shared file system.
- Note - by default most browsers will download files to the "Download" folder on a computer.β― You can change this behavior if you want by configuring the browser settings (instructions in PowerPoint deck).
4. Extension
- If you have time, encourage students to explore other options for the algorithm.
- Could something happen in the program based on the total of all your ages?
- Maybe it displays one type of sprite if the number is greater than a certain number, and a different type of sprite if the number is less than that number.
- What would you have to do to create that action?
- If you would like, you can show students the following example to demonstrate how this would work: student ages code.