add comments on time/space complexity