Example algorithms written in Scala