Rod Cutting Problem Algorithm