We use pow(a,b) function to calculate power, and it is inbuilt in cpp. What is its time complexity? If its log(n) then why do we need to know this exponentiation method?
Dount on this video
you are right .
but when we need to calculate (large values )mod N, then we need our modular exponentiation method which this inbuilt power function doesnt give.
like ex-;
calculate (2^2000 )%1003.
you cannot solve this using pow function as there will be an overflow , but you can use modular exponentiation to over come this.
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.