Scala versions of selected algorithms