what happens internally for pow(2,n) method?
what will be the time complexity and how is it different from 1<<n ?
Does 1<<n takes less time compared to 2**n and pow(2,n)?
hello @gandikotasasia1_d6d586dbd5c4388c
yes, becuase bit operations are faster ,also function call make pow(2,n) slow
How slow is pow(2,n) in terms of time complexity?
depends on implementation of pow(2,n) if u use linear appraoch then its O(n)
if u use exponentation then O(logn)
ok sir understood, thank you
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.