Basic algorithm as in the article (slow)
Basic algorithm as in the article (slow)