Assignment: 2.6 Algorithm Basics

AP CSP
2016-09-15T19:21:19Z

Due: Sep 20, 2016 by 12:59am

Algorithm Basics

Introduction

In Lesson 1.2 we introduced the term algorithm and defined it as a step-by-step procedure of precise instructions that performs some calculation or computation.

Algorithms are at the heart of computer science. Algorithms, expressed in computer code and interpreted by the computer, are what make our computers such powerful and adaptable machines.

As we saw in the maze problems in Lesson 1.2, algorithms are constructed out of basic building blocks called control structures. There are three basic control structures:

Sequence– a sequence of instructions or statements.

Selection– a conditional instruction that lets the program branch between two or more alternatives.

Repetition (or Iteration)– a structure that repeats one or more instructions.

An amazing fact that has been proved by computer scientists is that all algorithms can be constructed by using just these three control structures. In other words, any algorithm that you would like to write to solve a problem can be built by a combination of sequence, selection, and repetition.

Blockly Maze Problems

If you didn't get a chance to work through the Maze problems in Unit 1 or if you want to solve a few more maze problems that use sequence, selection, and iteration, here's a link to some additional problems that use the Blockly language (instructions).

Review the Mobile CSP.org site and then...skip the POGIL activity.

Attach screenshots of self assessment.

Reflection: For Your Portfolio

Create a page named Algorithm Basics under the Reflections category of your portfolio and answer the following questions:

Suppose you had a list of positive numbers such as 5, 10, 12, 13, 6, 7, 1, 3, 2, 1. And suppose for each of the numbers in the list you added the number to a running total if it is even and subtracted it if it is odd.

What result would you get for this list of numbers?

Write a pseudocode algorithm that implements the algorithm you used to calculate this total.
In this lesson you learned about pseudocode. Write an algorithm in pseudocode for washing a stack of 5 cups and saucers, where the rule is that cups are washed in hot water and saucers in cold water. Use indentation to make your algorithm easy to read and identify those parts of your algorithm that are examples of Sequence, Selection, and Repetition.

Algorithm Basics

Introduction

In Lesson 1.2 we introduced the term algorithm and defined it as a step-by-step procedure of precise instructions that performs some calculation or computation.

Algorithms are at the heart of computer science. Algorithms, expressed in computer code and interpreted by the computer, are what make our computers such powerful and adaptable machines.

As we saw in the maze problems in Lesson 1.2, algorithms are constructed out of basic building blocks called control structures. There are three basic control structures:

Sequence– a sequence of instructions or statements.

Selection– a conditional instruction that lets the program branch between two or more alternatives.

Repetition (or Iteration)– a structure that repeats one or more instructions.

An amazing fact that has been proved by computer scientists is that all algorithms can be constructed by using just these three control structures. In other words, any algorithm that you would like to write to solve a problem can be built by a combination of sequence, selection, and repetition.

Blockly Maze Problems

If you didn't get a chance to work through the Maze problems in Unit 1 or if you want to solve a few more maze problems that use sequence, selection, and iteration, here's a link to some additional problems that use the Blockly language (instructions).

Review the Mobile CSP.org site and then...skip the POGIL activity.

Attach screenshots of self assessment.

Reflection: For Your Portfolio

Create a page named Algorithm Basics under the Reflections category of your portfolio and answer the following questions:

Suppose you had a list of positive numbers such as 5, 10, 12, 13, 6, 7, 1, 3, 2, 1. And suppose for each of the numbers in the list you added the number to a running total if it is even and subtracted it if it is odd.

What result would you get for this list of numbers?

Write a pseudocode algorithm that implements the algorithm you used to calculate this total.
In this lesson you learned about pseudocode. Write an algorithm in pseudocode for washing a stack of 5 cups and saucers, where the rule is that cups are washed in hot water and saucers in cold water. Use indentation to make your algorithm easy to read and identify those parts of your algorithm that are examples of Sequence, Selection, and Repetition.