Algorithms and data structures in Java and Scala