Week 2 programming assignment of Algorithm, Part 1 from Princeton University in Coursera