Homework for analysis and design of algorithms class.