Please explain how to calculate time complexity.