I think your temporary code complexity is O(2^n log n)because you are calculating 2^nfor 2^ntimes.
a^bcan compute in O(log b)for squaring , and I think the exponential algorithm in python is an algorithm O(log n).
Therefore, the time complexity O(2^n log n).
source
share