solutions to some exercies from K and R.