Algorithms and data structures in Scala