Algorithm design and analysis exercises reference answer