algorithms coursera chapter 2