1 - Fundamentals of Algorithms Flashcards

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

What is an algorithm?

e.g. directions

A

An algorithm is a sequence of steps that can be followed to complete a task. A computer program is an implementation of an algorithm and an algorithm is not a computer program

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

What is decomposition?

e.g. recipe

A

Decomposition is breaking a problem into a number of sub-problems, so that each sub-problem achieves an identifiable task, which might itself be further subdivided

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

What is abstraction?

e.g. London tube map

A

Abstraction is the process of removing unnecessary detail from a problem

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

What is a model for how a computer operates?

A

The input-process-output model helps to show how a computer operates.

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

What is the input stage in a computer, and where does it take place in the algorithm?

A

The input stage is the flow of data into the process from outside the system. It takes place at the start of the algorithm

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

What is the process stage in a computer, and where does it take place in the algorithm?

A

The process stage includes all the tasks required to affect a transformation of the inputs. It takes place in-between the input and output stage

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

What is the output stage in a computer, and where does it take place in the algorithm?

A

The output stage is where the data and information flow out of the transformation process, and it takes place at the end of the algorithm

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

What are flowcharts?

A

Flowcharts are diagrams that represent an algorithm

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

What does the flow line mean?

A

The flow line shows the sequence of operations. These must go in through one box and out of the other.

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

What does a terminal symbol mean?

A

The terminal symbol denotes the start or end of the algorithm

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

What does the processing symbol mean?

A

The processing symbol denotes a process to be carried out

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

What does a decision symbol mean?

A

A decision symbol is used to represent the operation in which there are 2 alternatives

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

What structures can be used for flowcharts?

A

Sequence, Selection and Iteration structures

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

What is pseudocode?

A

Pseudocode is a way of developing an algorithm, which consists of natural language-like statements that precisely describe the steps required

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

What are assignment operators?

A

Operators that set the value of the variable in pseudocode

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

How do you input something in pseudocode?

A

VAR

17
Q

How do you output something in pseudocode?

A

OUTPUT (or PRINT, DISPLAY, SHOW, RETURN) ‘information’

18
Q

How do you process or compute something in pseudocode?

A

COMPUTE, CALCULATE, DETERMINE

19
Q

How do you comment on your pseudocode?

A

By using # key

20
Q

How do you add selection in pseudocode?

A

By using IF, THEN, ELSE, ENDIF statements

21
Q

How do you represent pseudocode as a flowchart (and vice versa)?

A

By matching each statement with whether it is an input, output, process, terminal or decision statement

22
Q

How do we use a trace table to identify how simple algorithms work?

A

A trace table is a technique used to see if any logic errors are occurring whilst the algorithm is being processed

23
Q

How can visual inspection be used to see how a simple algorithm works?

A

By looking at it to see if any logic errors occur based on the expected outcome and the actual outcome of the algorithm

24
Q

What types of loops can be used in pseudocode?

A

FOR loop, WHILE loop, REPEAT … UNTIL loop

25
Q

When will you use a FOR loop and how should you use it?

A

You use a FOR loop when you know how many times you want a loop to repeat:
E.g.
FOR I

26
Q

When will you use a WHILE loop and how should you use it?

A
You use a WHILE loop when you loop a code based on a certain condition, which is checked at the start:
e.g.
WHILE a < 5
OUTPUT a
ENDWHILE
27
Q

When will you use a REPEAT … UNTIL loop and how should you use it?

A
You use a REPEAT UNTIL loop when you loop a code based on a certain condition, which is checked at the end:
e.g.
REPEAT
OUTPUT a
UNTIL a < 5