algorithm homework 2b