added analyze code for both algorithms