Algorithms assignment 1