Algorithms 1. Definition and Complexity Flashcards

1
Q

What is an algorithm?

A

An algorithm is a finite sequence of operations for carrying out a procedure or solving a problem.

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

What may an algorithm be communicated in?

A

An algorithm may be communicated by using pseudocode or a flowchart.

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

What is an iterative process?

A

A repeating process which uses a loop

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

What is a pass?

A

Working through the loop once is known as a pass.

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

How can an algorithm be proved correct using proof by exhaustion?

A

Proof by exhaustion may be appropriate if the number of possible inputs is small.

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

How can an incorrect algorithm be disproved?

A

An incorrect algorithm can sometimes be disproved by counter-example.

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

What is algorithm complexity?

A

The study of how algorithms scale in both time and space

It can be used to compare difference algorithms to see which perform better and may also help establish performance expectations for different sized data

Concerns how fast or slow a particular algorithm performs.

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

What does O(n^2) mean?

A

Quadratic complexity

This would mean that if n is doubled a computer program would take approximately four times as long to run the algorithm.

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

What is pseudocode?

A

Concise instructions that could form the structure of a computer code but have no particular computing language / syntax
-Common sense should be used and applied to instructions

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

Why are pseudocode written in numbered lines e.g. 10?

A

Easy reference / adaptation if we want to add step in between e.g. step 15 in-between steps 10 and 20

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