Calculate Power using Recursion (Logarithmic) | Recursion in JAVA

preview_player
Показать описание


The previous version expects the call stack to be of n height. This function expects call function to be only log(n) high.

#recursion #algorithm

Рекомендации по теме
Комментарии
Автор

this channel deserve million subscribers, thankyou sumit sir

kuldeepnarayanminj
Автор

This channel becomes main source for DSA. Hope this channel will boom with likes and views and subscribes very soon.

Thank u sumit sir

CodeCraftWithVinayak
Автор

The best Channel for DS and Algo and Kudos to Sumeet Malik

yashvardhansoni
Автор

never seen a teacher like u thanku so much for ur efforts

DanishKhan-lhob
Автор

One of the best lectures, you sorted my life <3. Lots of love, and keep growing.

riaria
Автор

bhai mtlb ek number bhot ache se explain kra h apne i have completed recursion in just 2 days buy ust taking hint from your videos thank you very much

sanskargupta
Автор

Thanks.. this word is very small and invaluable as compared to your contribution.
Just no words .. Sir...

AshishKumar-xgdm
Автор

The way he explain these concepts is just awesome

NikhilGuptadtu
Автор

Watched on 10th October, 2021 - Thanks for the video.

raj_kundalia
Автор

good one. I understand log n complexity basics so easily. Big thumps up :)

kargud
Автор

Wow sir such a great lecture. Thank you so much

AnoopSingh-uyng
Автор

sir, you used divide and conquor strategy na?

ritikshrivastava
Автор

Thank you SUMIT sir .
Great lecture 😻
love with your lectures.
Sir TIME

princepawar
Автор

Sir after watching this video only I'm getting some idea about time complexity briefly.

janeshwaranjanu
Автор

04:52 ye kaafi nhi hoga even if n is even as for last cycle of recursion, n odd hi hoga. Example for n=4, first n/2 will be 2 and second n/2 will be 1. Which will use that condition to get the x.

oooo__-__
Автор

What a explanation sir ji you are great😃😃😃✌️

luckyismynickname
Автор

bhai main barso se is problem ko nhi samjh paya tha..aaj iss moodh atma ka uddhar hua :P:P. Thank you

sachinpandey
Автор

sir negative values of n k liye ye code run time error show krta hai
isko kaise handle karen

dipanshujoshi
Автор

Faith bola hm krte h parbandh ! Sumit sir

raushankumargupta
Автор

sir why we take variable to store power... whereas we can simply return the result directly????




public static int power(int x, int n){

if(n==0){

return 1;
}

if(n%2==0){

return power(x, n/2)*power( x, n/2);

}

else{

return x*power(x, n/2)*power(x, n/2);

}
}

FirstLearningthanEarning