Assignment for coursera Alg4s Week 2