Recursive Vs Iterative Algorithms
Functionality
โป๏ธ Recursive algorithms | ๐ Iteration algorithms | |
---|---|---|
Start | return from recursive call level below | restart of loop |
End | Termination condition(s) check before processing | Loop condition failed |
Calculation | result gets calculated on multiple function levels | result gets calculated on one function level |
Pros&Cons
โป๏ธ Recursive algorithms | ๐ Iteration algorithms | |
---|---|---|
โก๏ธ Efficiency | often ๐, more RAM | often ๐, less RAM |
Implementation | easy ๐ | harder ๐, but depends (support for recursion?) |