coursera algo1: 1st prog assignment