Iteration Vs Recursion Flashcards

1
Q

What is iteration?

A

Using a for or while loop to loop through a piece of code multiple times

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

What is recursion?

A

A function calling itself

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

Advantages of recursion?

A
  • Results in shorter code
  • Code looks less complex and is more elegant
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Advantages of iteration?

A
  • Programme may run faster
  • Cannot run out of memory
  • Easier to trace/follow
How well did you know this?
1
Not at all
2
3
4
5
Perfectly