[Coursera][Algorithms] assignment for week 5, final version