add time and space complexity
add chapter 4 question 7