Solving problems and exercises from Algorithms 4th edition