Week 5 programming assignment of Algorithms, Part I from Princeton University in Coursera