Ingap.dev - A Personal Dev Blog

If you don't get the requirements right, it doesn't matter how well you do anything else. (Karl Wiegers)

Tag: iteration

See the content related to iteration...

Thursday 15 December 2022

[CODE] Integer partition function in Python (recursive and iterative)

The integer partition function p(n) is the number of ways of writing n as a sum of positive integers, where the order of the summands does not matter. Let's see how to implement it recurively and iteratively.

recursion iteration algorithm python

Tuesday 8 November 2022

From recursive to iterative functions (step by step)

Recursive and iterative algorithms are two ways of solving problems. A recursive algorithm calls itself repeatedly until it reaches a base case, while the iterative one uses a loop to repeat operations until a condition is met. Both can achieve the same results but have different advantages and disadvantages. In this article, we will see how to turn a recursive into an iterative function step-by-step.

recursion iteration algorithm python