Algorithm Homework