Top Stories published by 100 days of algorithms in March of 2017

Day 1: Hanoi tower

Let’s begin with a simple algorithm, yet, mind-bending if you have never seen it before. Hanoi tower has a beautiful literate solution using recursion.

Just think of it, we need to move the largest disk to right tower, first. For that, we need to move all but this disk…


100 days of algorithms challenge

Two of my colleagues, Jirka Penzéš and Jarda Holáň, brought me to this idea. And I love it. For the next period of my life I’m going to publish an implementation of algorithm regularly, day by day, until the number reaches 100.


Day 3: Next permutation

Given a totally ordered set, find the next permutation of the current configuration: FADE -> FAED -> FDAE -> FDEA -> ...

Even though almost every library offers a similar function, this tool can quickly become very useful in various competitions when you need…


Day 4: Counting 1-bits

When you write down a positive integer as binary number, how many 1s do you get? For example, 99 = 0b1100011

An obvious solution would be to take a single-bit mask, walk over the number X & (1 << k) and count non-zero results up. But this solution counts both 0s


Day 6: Postfix notation

While humans mostly use infix notation of algebraic expressions, Reverse Polish notation or postfix notation is much easier to parse algorithmically.

For example, these expressions are equivalent, the first one is in infix form and the second one is in postfix…

About
100 days of algorithms
100 days, 100 algorithms - a challenge consisting of many small pieces
More information
Tags
Editors