Homework from Algorithms class