Week 10 - Algorithms & Recursions Flashcards

1
Q

What are the 5 parts which define an algorithm?

F
D
EP
PO
TI
A
  1. Finite - it ends
  2. Definite - it isn’t subjective and is precise
  3. Effective Procedure - can be carried out effectively
  4. Produces Output - has a result or effect
  5. Takes Input - obtains values to use
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What’s an example of an algorithm?

A

Rounding pi to 5 decimal places.q

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

What does computational complexity measure?

A

How efficient programs are and the relationship between performance and data sets.

These two things are can be related quadratically, linearly, exponentially, logarithmically or by a constant value.

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

What does n represent?

A

Can be either time or memory.

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

Recursion

A

A process of looping where the program will call itself.

It’s also related to the mathematical topic called proof by induction where similar methods are used to show something is true for n and for n+1.

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

What are the 3 parts of recursion?

I
R
T

A
  1. Initialisation: declaring a counter
  2. Repetition: incrementing the counter
  3. Terminations: ending the counter using conditional statements or end keywords.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly