Algorithms written in Scala