finish chap5 recursion