Added algorithm analysis section and answered last question