add psuedocode to ex.4