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
2
Q
What is recursion?
A
A function calling itself
3
Q
Advantages of recursion?
A
- Results in shorter code
- Code looks less complex and is more elegant
4
Q
Advantages of iteration?
A
- Programme may run faster
- Cannot run out of memory
- Easier to trace/follow