Psuedocode for checking algorithm