second homework for algs1 course on coursera