## What is amortised time complexity and method to calculate?

**Amortized time complexity** is a measure of the efficiency of an algorithm that takes into account the average time taken by the algorithm over a sequence of operations, rather than just the worst-case or best-case time complexity.

One method for calculating the amortized time complexity of an algorithm is the “aggregate analysis” method. In this method, the amortized time complexity of an algorithm is calculated by considering the total time taken by a sequence of operations and dividing it by the number of operations.

For example, suppose we have an algorithm that performs a sequence of n operations, and the time taken by each operation is denoted by t(i). The amortized time complexity of the algorithm can be calculated as follows:

Amortized Time Complexity = (t(1) + t(2) + t(3) + … + t(n)) / n

This calculation gives us the average time taken by each operation in the sequence.

Another method for calculating the amortized time complexity of an algorithm is the “potential method”. In this method, we assign a “potential” value to each operation, and the amortized time complexity of the algorithm is calculated by summing the potential values of all the operations in the sequence. The potential method is more complex than the aggregate analysis method and requires the use of mathematical concepts such as recurrence relations.