2.6K Followers
·
Follow

I wrote the first algorithm on March 25. I wrote the last one today, on July 2. 100 days, 100 algorithms, 100 articles.

Many thanks to everyone of you for your support. You have helped me with this series more than you might think.

I also have two honourable mentions, Cristian Randieri, Phd and Pavel Rihosek. Of all the people, I appreciate your support most, thank you.

I tried to pick somewhat interesting topics and to show that even more complex algorithms can be written with ease. …


For the 100th algorithm I chose a segmented Eratosthenes sieve for primes up to 10⁹ implemented in Cython. And this time the goal is to provide an algorithm that is as fast as possible.

There are several reasons why I diverged from Python and the usual type of implementation. Among others, I like breaking rules and I like optimizations. But what’s most important…

In most of the articles I have tried to provide as short and nice implementation as possible. …


Linear programming is an area of mathematics that deals with the simplest form of constrained optimization problem — linear program. And simplex should definitely be in your toolbox if you are serious about algorithms.

Here is an example of a linear program [in standard form].

maximize: -x + 3y + 2z

subject to:
x + y + z ≤ 6
x + z ≤ 4
y + z ≤ 3
x + y ≤ 2

x, y, z 0

The simplex algorithm is rather straightforward. We convert the system of inequalities into system of equalities and then use Gaussian elimination with clever pivot selections. …

About

Tomáš Bouda

PyDev

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store