algorithms chapter exercises 1,2