Computer Science & Design Thinking
A
8.1.5
Algorithms & Programming
P
8.1.5
1
A
New Jersey Student Learning Standards
Technology:
[Link].1: Compare and refine multiple algorithms for the same task and
determine which is the most appropriate.
[Link].2: Create programs that use clearly named variables to store and
modify data.
[Link].3: Create programs that include sequences, events, loops, and
conditionals.
[Link].4: Break down problems into smaller, manageable sub-problems
P
to facilitate program development.
[Link].5: Modify, remix, or incorporate pieces of existing programs into
one’s own work to add additional features or create a new program.
8.1.5
2
Core Concept 8.1.5 Algorithms & Programming
An algorithm is a sequence of steps
designed to accomplish a specific task.
A
Algorithms are translated into programs,
or code, to provide instructions for
computing devices. Algorithms and
programming control all computing
systems, empowering people to
P
communicate with the world in new 8.1.5
ways and solve compelling problems.
3
➢
➢
Topics Covered
Communication Between Humans
Algorithms
A
P
➢ Debugging
➢ Programming
➢ Computer Programming
➢ Works Cited 8.1.5
4
A
P
8.1.5
5
People have always created
A
methods to communicate in
nonverbal ways. People create
codes with pictures and ↪↻↾
←⍇╅
P
symbols to share secret ┆┗
☨♽
8.1.5
⛕⛤
messages! ☡✆
⛦⛚
⛓⛮
6
People use
A
flashlights in the
dark to send and
receive secret
P
messages! 8.1.5
7
Fire and smoke
A
signals have been
used share secret
messages!
P
8.1.5
8
People create and
A
use pictographs to
represent letters or
words in order to
P
share secret 8.1.5
messages.
9
Braille is a reading
A
and writing system
for blind and vision
impaired people,
made up of raised
P
dots that can be 8.1.5
'read' by touch.
10
Sign language is used
by people who are deaf.
A
The gestures or
symbols in sign
language are organized
P
in a linguistic way. Each 8.1.5
individual gesture is
called a sign.
11
Sign language Each sign has three
A
distinct parts:
◆ the handshape,
◆ the position of the hands, and
◆ the movement of the hands.
American Sign Language (ASL) is used
P
most in our country. Other countries have 8.1.5
their own sign language.
12
Again, people have
A
always found ways to
communicate
P
8.1.5
nonverbally!
13
A
P
8.1.5
14
List three tasks or
A
things you do
everyday?
P
8.1.5
15
Examples of Daily Tasks
★ getting ready for school
A
★ brushing teeth
★
★
★
★
tying sneaker strings
travelling to or from school
school day
structure of a class
P
★ participating in clean-up time 8.1.5
16
Take one item
A
from your list and
write the steps you
use to complete
P
that task.
8.1.5
17
A
Congratulations!
You have just created
your first algorithm!
P
8.1.5
18
Sooooo!
A
What is an
algorithm?
P
8.1.5
19
An algorithm is a recipe book!
In the recipe book, you have
A
list the step by step
instructions on how to make
your favorite sandwich.
The sequence is the specific
P
order instruction of your 8.1.5
instructions.
20
In fact, the instructions
A
are so good, that
anyone who follows the
recipe can make the
same, exact sandwich!
P
8.1.5
21
A computer algorithm
A
is like a set of
instructions that tell
the computer what to
do!
P
8.1.5
22
So, just like your recipe book
tells you how to make a
A
P
sandwich, a computer
algorithm is a
list of step by step
instructions that a computer
program follows in order to 8.1.5
complete a task (run a program).
23
A
People use pseudocode (a
notation resembling a simplified
programming language, used in
program design), to create and
P
8.1.5
assess an algorithm before
coding.
24
Representing Yes or No
A
P
Yes No
1 2 8.1.5
25
Directional Arrows
A
P
left
right
up
down
Clockwise turn 8.1.5
Counter clockwise turn
26
Simple algorithms,
A
start, complete a
sequence of steps
then stop. P
8.1.5
27
A
P
8.1.5
28
In order for your
algorithm to work
A
you must use
provide, clear,
precise and STEP …
P
STEP 4
efficient steps! STEP 3 8.1.5
STEP 2
STEP 1
29
Use the box below
to write a dance
Dance Algorithm
A
P
algorithm that
makes your human
robot dance. It
must last for at
least 15 seconds.
8.1.5
30
Algorithms with a
loop allow you to
A
repeat sets of
instructions
without having to
P
write them out 8.1.5
multiple times.
31
Revisit your dance
algorithm. Look
Dance Algorithm Revision#1
A
P
for steps that you
repeat for
example “step to
the left three
times”. Revise
your algorithm to
include loops.
8.1.5
32
Repetitive
Algorithms or
A
“Do Loop”
requires a
program to run
P
multiple times. 8.1.5
33
A
P
8.1.5
34
A
P
8.1.5
35
Decision Making or Conditional
Algorithms allow selection, making different
A
things happen based on different conditions. You
use this process everyday to make decisions.
P
8.1.5
36
A
P
8.1.5
37
A
P
8.1.5
38
A
Sometimes, a problem is too big.
In this case, we decompose or
break down a problem or task P
into smaller, more manageable
8.1.5
parts.
39
A
P
8.1.5
40
Debugging is the process of
A
finding and fixing errors. A bug is
present anytime your program
does not function as expected.
P
8.1.5
41
Errors stop your program from
A
working correctly. Possible errors
could be:
Logic - testing for being to hot when you
meant to test for being too cold.
P
Sequence - steps are in the wrong order. 8.1.5
Spelling mistakes
42
Debugging your
dance algorithm.
Dance Algorithm Revision#2
A
DEBUGGING
P
Were there any parts
that confused your
human robot? Go
through and clarify,
DEBUG confusing
steps.
8.1.5
43
A
P
8.1.5
44
Let’s look at the
A
P
way people
communicate
with computers!
8.1.5
45
Programs store and manipulate
A
data by using numbers or other
symbols to represent information.
Let’s go through a few examples.
P
8.1.5
46
A
ASCII (American Standard Code
for Information Interchange) is the
most common character encoding
P
format for text data in computers 8.1.5
and on the internet.
47
A
P
8.1.5
48
A
Binary code is one type of coding that
uses only 0 and 1 to represent letters,
numbers, and symbols. It is called
binary code because it’s made of only
P
two symbols. The “bi” in binary means 8.1.5
two!
49
A
The hardware of computers has only
two electrical states, on or off. These
can be represented by
P
● 0 or zero (off), or 8.1.5
● 1 or one (on).
50
A
P
Letters, numbers, and symbols are
translated to eight-character binary
numbers (0 and 1) as you work with
them through the software on your 8.1.5
computer.
51
A
P
8.1.5
52
A
P
Unicode provides a unique number.
This means that text can be shared
and displayed across different
systems without loss of information
8.1.5
or character corruption.
53
A
Unicode assigns each character a
unique code point. Look at the example
below:
P
"A" is U+0041 8.1.5
54
A
P
8.1.5
55
A
Unicode supports over a million code
points, which can represent
characters from various scripts,
P
symbols, emoji, and more.
8.1.5
56
A
P
One of the key advantages of Unicode is its
universality and inclusivity, allowing for the
representation of text in numerous
languages and scripts, including those that
are not traditionally supported by older 8.1.5
encoding standards like ASCII.
57
A
This makes Unicode very
important for multilingual
computing, internationalization,
P
and globalization of software 8.1.5
and content.
58
A
P
8.1.5
59
A
Imagine you have a big box of colorful
building blocks. Each block is like a little
instruction for the computer to follow. When
you put these blocks together in a certain
order, they tell the computer what to do, just
P
like when you follow the steps to build a 8.1.5
tower with your blocks.
Now, these blocks are special because 60
Now, these blocks are special because they're
A
made for the computer. They tell it how to do
things like play a game, draw a picture, or even
talk to other computers far away. When you
press a button on the computer or a tablet, it
P
follows the instructions from these blocks to do 8.1.5
what you want, like open a game or show a
video.
61
// Function to collect numbers from the user
A
So, computer programs are
P
function collectNumbers() {
let numbers = [];
for (let i = 1; i <= 4; i++) {
let input = prompt("Enter number " + i + ":");
let number = parseFloat(input);
if (!isNaN(number)) {
like sets of instructions that
[Link](number);
} else {
alert("Invalid input. Please enter a valid number.");
return null;
}
}
tell the computer what to do,
return numbers;
}
// Function to calculate sum of numbers
function calculateSum(numbers) {
let sum = 0;
just like you use instructions
for (let number of numbers) {
sum += number;
}
return sum;
}
// Function to calculate average of numbers
to build something with your function calculateAverage(numbers) {
}
let sum = calculateSum(numbers);
return sum / [Link];
building blocks!
// Main function
function main() {
let numbers = collectNumbers();
if (numbers !== null) {
let sum = calculateSum(numbers);
8.1.5
let average = calculateAverage(numbers);
alert("Sum: " + sum + "\nAverage: " + average);
}
}
// Call the main function
main();
62
1. OpenAI. 2024. ChatGPT (2023) Algorithms & Programming.
A
P
Retrieved from [Link]
2. What is Braille?
3. What is Sign Language?
4. What is ASCII?
5. What is Binary Code?
8.1.5
63