code for homework 2 CS594/CS454