Algorithms and datastructures in Java