HW2 Algorithms