I would spend 55 minutes defining the problem and then five minutes solving it. (Albert Einstein)

*Tag:* algorithm

See the content related to algorithm...

Thursday, 15 December 2022

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.

Tuesday, 8 November 2022

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.

Saturday, 22 October 2022

The Bellman-Ford algorithm finds the shortest path from a given source node to all other nodes allowing edges with negative weights. Here's a ready to use Python code implementing it.