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?) |