difference between iterative and recursive method
Iterative
|
Recursive
|
1.
Function calls some other function
|
Function calls itself
|
2.
Loops are used
|
If statement is used
|
3.
One function call is enough
|
Several function calls are required to get the result
|
4.
Fast
|
Slow
|
5.
Easy to write
|
Difficult to write
|
6.
We require a method or procedure to design
iterative method
|
We require a formula to design a recursive method, it is very
difficult to write if there is no formula
|
7.
No stacks are used
|
o/s used stacks during execution time
|
No comments:
Post a Comment