finished algorithm analysis