homework assignement 3 for cs 161