O($n^2$) is a time complexity notation which says that algorithm execution grows quadratically with input size, because of nested iterations over the data.
Example:
- Input size (n) = 4 -> $4^2$ = 16 operations
- Input size (n) = 8 -> $8^2$ = 64 operations
- Input size (n) = 16 -> $16^2$ = 256 operations
![[quadratic.png]]
My observation is that loop amount in your algorithm that iterates over every item in input dataset, determines exponent in exponentiation
2 loops = O($n^2$)
3 loops = O($n^3$) - also referred as `Cubic Time Complexity`
4 loops = O($n^4$)
If you have 4 nested loops, then for 20 elements, you need to do $20^4$ operations, which equals 160000 (!!!)
### See also
1.
### Reference
1.