algs4 programming assignment 2