CS174 homework 3