iteration
Repeating a block of steps in a loop, as opposed to having a function call itself.
In more detail
Any recursive function can be rewritten iteratively, often with an explicit stack standing in for the call stack. An iterative version avoids Python's recursion limit and the memory of many stack frames. Iterative binary search and iterative depth-first search are common examples.
Related terms
- recursion — A technique where a function solves a problem by calling itself on a smaller version of the same problem.
- call stack — The region of memory where a running program keeps one frame for each function call that has started but not yet returned.
Taught in
- Why Complexity Matters In Production — Algorithms & Data Structures for Working Engineers
- Recognising The Common Growth Rates — Algorithms & Data Structures for Working Engineers
- Space, In-Place Work And The Call Stack — Algorithms & Data Structures for Working Engineers
- Binary Search And Its Invariant — Algorithms & Data Structures for Working Engineers
- AVL Trees: Rotations That Keep The Guarantee — Algorithms & Data Structures for Working Engineers
- Depth-First Search, Cycles And Topological Order — Algorithms & Data Structures for Working Engineers