pseudocode for chapter 2 problems