## Lesson Summary

Pre-lesson Preparation

This is the second session on algorithms

Summary

During the second session, the students will use pseudocode to describe an algorithm.

Outcome

• Students will write pseudocode using sequencing, selection, and iteration constructs.
• Students will write pseudocode for algebra / geometry formulas.
• Students will write pseudocode for determining if a year is a leap year.

Overview

1. Getting Started (5 min)
2. Guided Activities (40 min)
1. PowerPoint
2. Think-Pair-Share
3. Solutions check
3. Wrap Up (5 min)

## CSP Objectives

Big Idea - Creativity
• EU 1.1 - Creative development can be an essential process for creating computational artifacts.
• LO 1.1.1 - Apply a creative development process when creating computational artifacts. [P2]
• EK 1.1.1B - Creating computational artifacts employs an iterative and often exploratory process to translate ideas into tangible form.
• EU 1.2 - Computing enables people to use creative development processes to create computational artifacts for creative expression or to solve a problem.
• LO 1.2.5 - Analyze the correctness, usability, functionality, and suitability of computational artifacts. [P4]
• EK 1.2.5B - A computational artifact may have weaknesses, mistakes, or errors depending on the type of artifact.
• EK 1.2.5C - The functionality of a computational artifact may be related to how it is used or perceived.
• EK 1.2.5D - The suitability (or appropriateness) of a computational artifact may be related to how it is used or perceived.
Big Idea - Abstraction
• EU 2.2 - Multiple levels of abstraction are used to write programs or create other computational artifacts.
• LO 2.2.1 - Develop an abstraction when writing a program or creating other computational artifacts. [P2]
• EK 2.2.1A - The process of developing an abstraction involves removing detail and generalizing functionality.
• EK 2.2.1B - An abstraction extracts common features from specific examples in order to generalize concepts.
• EK 2.2.1C - An abstraction generalizes functionality with input parameters that allow software reuse.
Big Idea - Algorithms
• EU 4.1 - Algorithms are precise sequences of instructions for processes that can be executed by a computer and are implemented using programming languages.
• LO 4.1.1 - Develop an algorithm for implementation in a program. [P2]
• EK 4.1.1A - Sequencing, selection, and iteration are building blocks of algorithms.
• EK 4.1.1B - Sequencing is the application of each step of an algorithm in the order in which the statements are given.
• EK 4.1.1C - Selection uses a Boolean condition to determine which of two parts of an algorithm is used.
• EK 4.1.1D - Iteration is the repetition of part of an algorithm until a condition is met or for a specified number of times.
• EK 4.1.1G - Knowledge of standard algorithms can help in constructing new algorithms.
• EK 4.1.1H - Different algorithms can be developed to solve the same problem.
• LO 4.1.2 - Express an algorithm in a language. [P5]
• EK 4.1.2A - Languages for algorithms include natural language, pseudocode, and visual and textual programming languages.
• EK 4.1.2B - Natural language and pseudocode describe algorithms so that humans can understand them.
• EK 4.1.2C - Algorithms described in programming languages can be executed on a computer.
• EK 4.1.2G - Every algorithm can be constructed using only sequencing, selection, and iteration.
• EK 4.1.2H - Nearly all programming languages are equivalent in terms of being able to express any algorithm.
• EK 4.1.2I - Clarity and readability are important considerations when expressing an algorithm in a language.
Big Idea - Programming
• EU 5.2 - People write programs to execute algorithms.
• LO 5.2.1 - Explain how programs implement algorithms. [P3]
• EK 5.2.1A - Algorithms are implemented using program instructions that are processed during program execution.
• EK 5.2.1B - Program instructions are executed sequentially.
• EK 5.2.1C - Program instructions may involve variables that are initialized and updated, read, and written.
• EU 5.5 - Programming uses mathematical and logical concepts.
• LO 5.5.1 - Employ appropriate mathematical and logical concepts in programming. [P1]
• EK 5.5.1A - Numbers and numerical concepts are fundamental to programming.
• EK 5.5.1E - Logical concepts and Boolean algebra are fundamental to programming.

## Math Common Core Practice:

• MP1: Make sense of problems and persevere in solving them.
• MP2: Reason abstractly and quantitatively.
• MP7: Look for and make use of structure.

## Common Core Math:

• A-SSE.1-2: Interpret the structure of expressions
• A-SSE.3-4: Write expressions in equivalent forms to solve problems
• F-IF.1-3: Understand the concept of a function and use function notation
• F-IF.4-6: Interpret functions that arise in applications in terms of the context

## Common Core ELA:

• RST 12.3 - Precisely follow a complex multistep procedure
• WHST 12.4 - Produce clear and coherent writing in which the development, organization, and style are appropriate to task, purpose, and audience

## NGSS Practices:

• 2. Developing and using models
• 5. Using mathematics and computational thinking
• 6. Constructing explanations (for science) and designing solutions (engineering)

## Key Concepts

Students will write pseudocode using sequencing, selection, and iteration constructs.

## Essential Questions

• How are vastly different kinds of data, physical phenomena, and mathematical concepts represented on a computer?
• How are algorithms implemented and executed on computers and computational devices?
• How do computer programs implement algorithms?

## Teacher Resources

Student computer usage for this lesson is: optional

Files in the Lesson Resources folder:

AlgorithmsPseudocode2.pptx : PowerPoint Slides for mini-lectures

Student Handout and Key for Matching Pennies Game

Student Handout for Rock Paper Scissors

Psuedocode Summary and Examples of common Algorithms.docx

# Getting Started (5 min)

• Homework Review from Session 1 (students were assigned to write pseudocode for selected Algebra/Geometry calculations)
• Journal: Describe the algorithm of another student. Is there enough detail to allow somebody to follow the steps?

# Guided Activities (40 min)

## PowerPoint

Walk through “Selection Statements”; “Iteration / Repetition” slides from the AlgorithmsPseudocode2 file in the Lesson Resources folder.

Things to stress with your students:

1.  Whenever you need to store information, it must go into a variable.  So think about what variables might be needed when you are creating your algorithm

2.  Selection and Iteration statements require conditionals.  Identify a conditional as something that returns a True or False answer.  If selects the next statement to occur by answering the conditional question as being true or false.  I have in the past pointed out the True and Then both start with T so TRUE always does the THEN, wherease Else and False both end with LSE, so when the answer if FALSE, you do the ELSE.

While continues to loop as long as the conditional answer is TRUE.  When the conditional answer is false, the  algorithm jumps to the statement after the End While.

3. Nearly all programming languages are equivalent in terms of being able to express any algorithm. Each has its own way to use variables, conditions and repetition which are needed for a solution to almost all algorithms.

## Guided Activity

During powerpoint, guide students through the Game of Matching Pennies (a student working copy and a solution key is in the Master Teacher Resource folder for this lesson).

## Think-Pair-Share

Students work in pairs to create and share their pseudocode.  Use the Rock Paper Scissors hand out to have student pairs psuedocode Rock Paper Scissors.  If there is time, have groups switch algorithms and critique the algorithm of the other group.

Walk through pseudocode syntax summary handout called Pseudocode Summary and Examples of common Algorithms.docx in Lesson Resources folder.

Students work through challenges and check their results against sample solutions.

# Wrap Up (5 min)

Review slide: "Why we have leap years."

## Homework:

Assign students to create pseudocode for leap years.

## Options for Differentiated Instruction

Pairing of students and crossing pairs to form groups of four should be used for the set of exercises that are part of this lesson.

Think-Pair-Share

## Summative Assessment

Students will write pseudocode for algebra / geometry formulas.  These will be entered into their class notes.

Students will write pseudocode for determining if a year is a leap year.  This will be entered into their journals.