2.1 Algorithm Flashcards
2.1.1 - Computational thinking
What is abstraction?
- ignoring unnecessary information
- focusing only on the important facts
- simplifies a problem to make it less complex
- program becomes more straightforward to understand the problem and create a solution
2.1.1 - Computational thinking
What decomposition?
- breaking a problem down into smaller tasks so that it is easier to solve
- each individual problem can be separately tested and solved
- enables different people to work on the different parts of a larger problem, that can later be recombined to produce a full solution
2.1.2 Designing, creating and refining algorithms
What is an algorithm?
- a set of instructions, presented in a logical sequence
2.1.2 Designing, creating and refining algorithms
Why do programmers create algorithm design?
- a method of planning a program before writing a code
- considers potential problems of the program
- makes it easier to start creater source code
2.1.2 Designing, creating and refining algorithms
What commands does selection use?
- if
- then
- else
- endif
eg:
if firstname == “Steven” then
print(“Hello” + firstname)
elif firstname == “Steve” then
print(“Please use full name”)
else
print(“Who are you?”)
end if
2.1.2 Designing, creating and refining algorithms
What commands does iteration use?
with examples
- for loop (for, to, step, next)
- while loop (while, endwhile)
- do while loop (do, until)
Iteration (for loop):
for i = 1 to 10 step 1
input item
next i
Iteration (while loop):
while firstname != “Steven”
firstname = input(“Try again:”)
endwhile
Iteration (do while loop):
do
firstname = input(“Guess name:”)
until firstname == “Steven”
2.1.2 Designing, creating and refining algorithms
Flowchart symbols
- start/stop - rectangle with rounded corners
- operation/process - rectangle
- decision (if statement) - diamond
- input/output - parallelogram
- subroutine - rectangle with 2 vertical lines
- direction of flow - arrow