01 - Keyed Notes - Introduction To Algorithms & Flowcharts
01 - Keyed Notes - Introduction To Algorithms & Flowcharts
Class Learning Objective: 3.1 How to…explain the three different ways algorithms can
be written & 3.2 How to… use flowcharts to help design algorithms
APCSP Essential Knowledge: AAP-2.A.1-4, AAP-2.B.1-7, AAP-2.C.1-4, AAP-2.E.1-2, AAP-
2.G.1, AAP-2.H.1, AAP-2.J.1, AAP-2.K.1, 4, 5, AAP-2.L.1-2, 5, AAP-2.M.1
Algorithms
Notes
Definition: A process or set of rules to be followed in order to perform a calculation or other
problem-solving operations
It costs more time to create an algorithm. It costs less time to create a flowchart.
Topic: Introduction to Algorithms & Flowcharts
Creating Flowcharts
Flowcharts generally have a start point, an endpoint, inputs, outputs, possible paths to
follow, and the decisions that lead to those possible paths. Flowcharts help us get started
on creating an algorithm in programming.
Basic Symbol Meaning Function Example
Answers a question or
condition with a Boolean False Are you True
Decision hungry?
response (only 2 options:
“True or False” or “Yes or No”)
Usefulness of Flowcharts
Selection Flowcharts
**Can sometimes have multiple end spots depending on the “decision”**
If/Else
Topic: Introduction to Algorithms & Flowcharts
Iteration Flowcharts
**There are 2 main types of iterations**
For Loop While Loop If you notice, for and while loops
look VERY similar. Use this
comparison to figure out which
one is more appropriate to use.
More Practice
The following flowchart classifies animals as herbivore, carnivore, or
omnivore. Study the flowchart and answer the questions below.
a. Put a rectangle around the decision structure.
Follow the flowchart below with the indicated different inputs to see the new
final number. Complete the table with the final number.
Final
Number A Number B
Number
4 7 39
13 100 130
5 90 104
40 50 134
1 2 28
Topic: Introduction to Algorithms & Flowcharts
More Practice
This is a flowchart for taking attendance. Add the missing features below to it.
1) Four arrows are missing
2) A loop is missing
3) Assign yes/no labels for the decision.
No
Yes
No
Yes
Below you have 3 different flowcharts. Complete each step by writing in one of the
available options around the flowcharts (each option will only be used once out of all 3
flowcharts). Then indicate which flowchart displays a sequence, selection, and iteration
Check contents of
Put on shirt
wallet/purse
Add water
Go to the
Put on jacket
theatre
Stop
Topic: Introduction to Algorithms & Flowcharts
More Practice
1) Which types of algorithms are needed to compute the average height for a list
of basketball player heights? SELECT ALL THAT APPLY
a) Selection
b) Iteration
c) Sequencing
d) None of the above
2) Han develops an algorithm to compute the average amount of time that users watch a
particular video on YouTube. She realizes that the average is very low because of many
watch times with a duration "0" or "1“. She decides that the algorithm should ignore those
durations. What structure must be added to the algorithm so that it does not
consider those short durations when computing the average?
a) Selection
b) Iteration
c) Sequencing
d) None of the above
3) "Aba speak" is a game invented by school children to disguise what they're speaking.
When speaking, they transform each word following this algorithm:
For each letter in a word:
If letter is vowel:
Add "b" after
Add that letter after "b“
Following that algorithm, how would they transform the word "avocado"?
a) abavbvobocbcabadbdobo
b) abavobocabadobo
c) avabocabadabo
d) abavobacabadoba
e) abvobcabdob
1) Create a flowchart on how to clean the dishes one by one from a sink full of dirty dishes (think if
a loop can help reduce the number of steps). Turn your paper sideways if you need more room
vertically.