Professional Documents
Culture Documents
Aiep1 S3 SC
Aiep1 S3 SC
Website: amsliphil.com
Email address: amsliphil@yahoo.com
Student Copy
AIEP 1
Session 3
In simple terms, an algorithm is a list of steps and rules you follow in order to accomplish something, like
solving a problem or computing a value. We can see some semblance of algorithms in our daily lives,
like in cooking when following a recipe, in flag ceremonies, or in navigating the streets towards a
destination. For example:
Code
Computers are limited in what they can do. For example, your mobile phone might only know how to do
50 different instructions (for example, adding two numbers). Once manufactured, the things that a given
computer can do becomes permanent, that’s why it’s called hardware.
What makes computers capable of doing anything you can imagine is through code (programs). Out of
those few basic instructions, you can combine them to do more complex tasks. And unlike hardware,
computer code is easily changeable, that’s why it’s called software.
Since computers are limited in their capability, they don’t understand English. So they cannot execute an
algorithm written in plain English. Coding (or programming) is how you turn an algorithm into code that
computers can understand. In these lessons, we’ll use Scratch to do that. You can do a lot of things in
Scratch even if it only has limited instructions that it can do. You can create games, tell a story, play
music, solve a math problem – the possibilities are endless!
Activity as an Algorithm
Choose an activity that you usually do.
Then, list down all the steps in order to do it.
Activity:
Steps:
Repeat Until block – This repeats do something until condition is met. We’ll
discuss conditions in the next lesson.
To move a block, drag it. Dragging a block will move the block and all blocks connected to it below (but
not those above).
To duplicate a group of blocks, right-click and click Duplicate. This will duplicate the right-clicked block
and all blocks connected to it below (but not those above). Sometimes, you might find the duplicated
blocks underneath the other blocks.
A script is a group of blocks connected together (can just be one block). Normally, you use the green flag
button to properly run the whole program. But you can also run a script by clicking it.
Multiplication Algorithm
Oh no! Our computer forgot how to multiply two numbers.
Good thing it still knows how to add.
Here’s an algorithm for multiplying two numbers (multiplicand & multiplier) using only addition:
1. Set product to 0
2. Repeat the following multiplier number of times:
a. Add multiplicand to product
Let’s try it with 4 x 12. Get the product by adding 4 a dozen times.
4 x 12:
Boring and slow, no? Fortunately, computers don’t get bored. And they’re really fast!
Let’s open the Multiplication Algorithm project in Scratch in order to show you how fast they do it.