algorithm

A collection of 5 posts

A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
Feb 16, 2020 stream processing algorithm

Stream processing for computing approximations

This is the 2nd post in the Stream Processing focus series. Last week, we had a look at what is stream processing. In this post, I’d like to address one possible use-case for stream processing: the computation of mathematical approximations.

Nicolas Fränkel
Jan 27, 2019 algorithm performance kotlin

The sieve of Eratosthenes

Recently, I stumbled upon a Reddit thread pointing to a repository comparing the performances of implementations of the Sieve of Eratosthenes in different languages. The results were, let’s say, intriguing. The worst surprise came from Kotlin. I couldn’t believe my eyes! Then, I looked at the code.

Nicolas Fränkel
Apr 10, 2016 algorithm

Maze-walking algorithm

Last week, a colleague pointed out to my team an online developer recruitment challenge. As I find it fun and there was no need to disclose one’s email, I decided to try, just to check if I could to it. The problem is quite simple but not easy: consider a rectangular maze of finite size. One has to find a specific cell on the board - the exit, starting from the origin. One has 2 move options: one cell at a time in one of the 4 cardinal points or jumping to any previously visited cell.

Nicolas Fränkel
Mar 13, 2016 algorithm kotlin

Feedback on the Josephus problem

My last week article was about the solving the Josephus problem in Kotlin. For ease of comparison, here’s the version I wrote originally: class Soldier(val position: Int) { var state = State.Living lateinit var next: Soldier fun suicide() { state = State.Dead } fun isDead() = state == State.

Nicolas Fränkel
Mar 6, 2016 algorithm kotlin

Solving the Josephus problem in Kotlin

I recently stumbled upon a post telling about the Josephus problem and trying to solve it in different scripting languages. For the sake of brevity, here’s the problem (taken from the referenced post): Flavius Josephus was a roman historian of Jewish origin. During the Jewish-Roman wars of the first century AD, he was in a cave with fellow soldiers, 40 men in all, surrounded by enemy Roman troops. They decided to commit suicide by standing in a ring and counting off each third man.

Nicolas Fränkel
A Java geek © 2008-2026
v. bc04c88300c3ec997ce8470fbff5395dc9e518b1/13264050981
Latest Posts