Algorithm exercises and answers pdf. The state can be represented with three variables for storing the values of t...