Java implementation of some basic algorithm (std library from coursera)