2.1 Algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

algorithms

A

provide precise instructions needed to solve a problem

all computer programs are algorithms

a step-by-step procedure for solving a problem or carrying out a task

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

uses for algorithms

A

often used to improve efficiency by removing the need for human input

e.g. automatic-pilot systems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

advantages of an algorithm

A

a computer following an algorithm can decide what to do far quicker than a human, which can be extremely valuable (e.g. when stock market trading)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

constructs of an algorithm

A

sequence
selection
iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

sequence

A

instructions need to be given in the correct order

instructions are read in a specific order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

selection

A

decisions are made and a course of action is chosen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

iteration

A

previous steps are repeated until there is a desired outcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

reusing algorithms

A

they can be reused with slight changes for solving similar problems

quicker than starting from scratch each time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Write an algorithm to make a cup of instant coffee. It should be annotated to show where sequence, selection and iteration have been used [5]

A

1) fill kettle with water (sequence)
2) turn on kettle (sequence)
3) place coffee in the cup (sequence)
4) check if the water is boiling (selection)
5) if water is not boiling go back to step 4 (iteration)
6) pour water into the cup (sequence)
7) if needed, add milk and sugar (selection)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Algorithms use selection and iteration.

Define what is meant by:

a) selection
b) iteration [2]

A

a) selection in an algorithm is where a decision has to be made and a course of action has to be selected
b) iteration is where some of the steps have to be repeated until there is a required outcome

How well did you know this?
1
Not at all
2
3
4
5
Perfectly