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