Really great tutorial i really stuck in recursion but when you teach with very basic questions i really understood it well with what happens in background coding how recursion works 👍☺️☺️👏🙌
This is hands down the most comprehensive lecture for me ! Thank you for making such a high quality, lucid and brilliant explanation video on RECURSION, Your channel is Subscribed right away !
Great Great great Job!!!!. Actually Recursion is the toughest logic to implement and the way you teach specially coding in which u need to develop the thought process along with the problems.....you did it so well.....and in very simple way...... I have seen lot of videos on you tube but it is the BEST ONE !!!!great Contribution to community!!! Keep up the good work!!!!
1:24:04 below code works perfectly fine for both even and odd number, no need of using if else condition(if I'm wrong then run this code without condition) public static int optimisedFunc(int n, int power){ if(power == 1) return 1; return (n * optimisedFunc(n, power/2) * optimisedFunc(n, power/2)); }
For sum of n natural numbers, i guess correct way with recursion is.. public class Recursion { public static int printSum(int n) { if(n==1) { return 1; } return n + printSum(n-1); } public static void main(String[] args) { int n = printSum(5); System.out.println(n); } }
just use ternary operator n == 1 || n == 0 ? return 1 : n * factorial(n-1) ; 2 lines of code in just one line using ternary Thanks mam to make recursion easy to understand
Thank you so much all team members of aman bhiya aman bhiya you are doing really really really great work . when i wached apna college then i feel I'm graduating form Apna college institute of engineering and technology
53:57 We can also do this if we dont want to do anything in the main class - public class fibonacci { public static void main(String[] args) { int z = 5; int a = 0; int b = 1; int c = 0; calcFibonacci(a, b, c, z); } public static void calcFibonacci(int a,int b,int c,int z){ if(z==0){ return; } c = a+b; System.out.print(a); System.out.print(b); System.out.print(c); a = b+c; b = c+a; calcFibonacci(a, b, c, --z); } }
Another method for factorial using Recursion; static void fnc2(int n, int sum){ if(n == 0){ // BASE CASE System.out.println(sum); return; } sum *= n; // ACTION fnc2((n-1), sum); // sum will not change for each recursive step }
I didn't know Java language but still learning this video because C++ playlist has good content but not for beginainers But it is need more video like this on ds algo
At 40:10 public class Main{ public static void printfact(int x , int fact) { if(x == 0 || x== 1){ System.out.println(fact); return ; } fact *= x ; printfact(x-1 , fact); } public static void main(String[] args){ int x = 5 ; int fact = 1 ; printfact(x,fact); } }
public static int printSum(int n){ if(n ==0){ return 0; } else{ return n+ printSum(n-1); } public static void main(String args [ ] ){ int n =5; int ans = printSum(n); syso(ans); } An easy and better code for printing sum of n numbers using recursion
Hello guys! I am from Pakistan. I am learning java from this channel and she is one of the best teachers on TH-cam . The way she explains it is exceptional. I found this channel very valuable
Last question is so dengerious..Didi🙂dimag nehni chalapaya us type ke question par...but rest of the question are easy to catch...thanks for sharing this type of difficulty label class...❤❤❤
I am in Coding Ninja Coding boot camp, but they teach like, only doing there job. For understand the fundamentals and concepts, I always prefer Apn college. Very Easy explanation ❤❤❤
your teaching is FAB . I will join college this year and i am looking forward to watch your videos through my whole journey. Thank you for this amazing playlist didi..
In last question Calculate power: calcPower(x,n/2) was called twice, this can be optimised by storing the value in a variable. Overall very good video. Thankyou!
Hi shardha in function calpower we dont require to chk the condition for x since we are not editing it also the height of the stck can be reduced by adding a basecase of if(n==1) return x; so the height will be n-2 here pls correct if anything wrong Thankyou
Fibonacci series: 47:56
Power calculation : 1:00:13
Power calculation in optimized way : 1:12:00 ( log n) its code is : 1:22:40
th-cam.com/play/PLu0W_9lII9agS67Uits0UnJyrYiXhDS6q.html
Vaiii 46:56
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
Thnx buddy
Stack height concept you have tought was nothing anywhere generally...so thank you for such intuition.
at 30:30
public static int sum(int n){
if (n==0) {
return 0;
}
return n+sum(n-1);
}
is more convinient
yuo maine bhi esai kia
Really great tutorial i really stuck in recursion but when you teach with very basic questions i really understood it well with what happens in background coding how recursion works 👍☺️☺️👏🙌
Are you completing your college 😊
You guys are creating such a valuable content and providing it for free, also motivating us to be better in our fields, hats off to Aman and Shraddha.
VARANASI SARALA PUUKU MUNDADHI
Very valuable feedback for them
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
Need this type of practice question in every topic. Hope you continue like this. And thanks for this awesome session😍
This is hands down the most comprehensive lecture for me ! Thank you for making such a high quality, lucid and brilliant explanation video on RECURSION, Your channel is Subscribed right away !
Thank god you said that... I had my hands up this whole time :(
@@uskapyaar8852 😂😂😂😂
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
Best explanation ever..
Finally i understand recursion... 🥳🥳🥳🥳
Great Great great Job!!!!. Actually Recursion is the toughest logic to implement and the way you teach specially coding in which u need to develop the thought process along with the problems.....you did it so well.....and in very simple way...... I have seen lot of videos on you tube but it is the BEST ONE !!!!great Contribution to community!!! Keep up the good work!!!!
"JEE PREP HO YA COLLEGE KI PADHAI, ONE SHOTS ARE THE BEST!!"😂😂👌
How it's taking n as power ?? Like there is math.pow to that we can use power how this happen here??
😂😂
Wah wah wah wah
😂😂😂😂
@@just.indianstuff7537 yeah I also didn't understand this .how this is possible??
This is the best video on recursion. Thank you so much.
1:24:04 below code works perfectly fine for both even and odd number, no need of using if else condition(if I'm wrong then run this code without condition)
public static int optimisedFunc(int n, int power){
if(power == 1)
return 1;
return (n * optimisedFunc(n, power/2) * optimisedFunc(n, power/2));
}
Slowly aur easily padhaya hai awesome 😀
i can't explain how easily i was able to understand recursion in this video with time complexity,
thanks a lot to you ma'am
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
Didi, backtracking ke upar bhi dedicated playlist banaiye please
we want marathon on backtracking 🔥🔥🥰🥰
Yes
Need a complete course on java like the c++ complete series
Which college
@@prshark84 apna college
Thank youu dii..bas aise hi continue rkhna ab please 🥺❤️
For sum of n natural numbers, i guess correct way with recursion is..
public class Recursion {
public static int printSum(int n) {
if(n==1) {
return 1;
}
return n + printSum(n-1);
}
public static void main(String[] args) {
int n = printSum(5);
System.out.println(n);
}
}
what happens when we do return 1;
?
@@paragshende3390 when there is a function call (new stack frame) with n==1 then 1 is returned back to stack frame from where this call is made
this is simple way to calculate sum of n number which you explained.good job
Yes you are right. I also did the same
Bhagwan apka bhala kre... recursion ko detail se smjhane ke liye apka bahut bahut dhanyawad..
You are amazing! I am a 52 years old but i understand the concepts very well because of you. Thanks!
52 ? And learning java ..? I mean for what ? 😅
@@i.khushii maybe because the institute asked her to my oops teacher was in same position
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
Kitna aacha samjaya h apne didi.
Thankyou so much to making a good start in recursion.
just use ternary operator n == 1 || n == 0 ? return 1 : n * factorial(n-1) ; 2 lines of code in just one line using ternary
Thanks mam to make recursion easy to understand
Probabily the best teacher in the world for computer science student.
*probably
You are Best Teacher Ever..main to aapka all time wala Fan ho gaya...now Recursion is Clear...
Bestest Video On Recursion ❤
This is something we can call Recursion
Thanku Di and thanku Aman bhaiya to bring such people for us❤🔥
ThankYou Shradha deedi.😊
Yes we need a dedicated playlist on backtracking topic 👍
@masskie star this video is not available, but why?🙄
Didi aapka contents PHYSICS WALLAH ke tarah hai...... High quality content of explaining, thank you didi....
Thank you so much all team members of aman bhiya aman bhiya you are doing really really really great work . when i wached apna college then i feel I'm graduating form Apna college institute of engineering and technology
53:57 We can also do this if we dont want to do anything in the main class -
public class fibonacci {
public static void main(String[] args) {
int z = 5;
int a = 0;
int b = 1;
int c = 0;
calcFibonacci(a, b, c, z);
}
public static void calcFibonacci(int a,int b,int c,int z){
if(z==0){
return;
}
c = a+b;
System.out.print(a);
System.out.print(b);
System.out.print(c);
a = b+c;
b = c+a;
calcFibonacci(a, b, c, --z);
}
}
Han but jyada lagega though yhan ye itna jyada nhai hai but take a big no. For consideration.
Another method for factorial using Recursion;
static void fnc2(int n, int sum){
if(n == 0){ // BASE CASE
System.out.println(sum);
return;
}
sum *= n; // ACTION
fnc2((n-1), sum); // sum will not change for each recursive step
}
Didi bhot achi video h kaafi kuch smjh aaya...Thankyouu😃
beauty with brain ,,, video par focus hi ni kar pata sara time apka face dekhkar hi nikal jata h 😍😍❤❤❤❤
Didi aaap bhot badiya padhti ho ❤️...
Concept arram se clear ho jate hai
Great explanation! Best lecture of recursion on you tube.
VARANASI SARALA PUUKU MUNDADHI
Madam your way of explaining is awesome
I didn't know Java language but still learning this video because C++ playlist has good content but not for beginainers But it is need more video like this on ds algo
1:21:32 here when alpha is 4 then hight of stack is 3 not equal to alpha
Execellent vedio! Best 👍💯 of I've ever seen
You guys are doing brilliant work.Love from Pakistan💖💖💖💖💖
👌🏻👌🏻 mja aa gya video dekh ke
The best part is you know shraddha didi hindi + English dono me hi explain kar deti hai toh smjh me bohot ache se aa jata hai 😊
i can gaurantee that this the best video on recursion
Waiting for this video from lot of time. Thanks 🤗
Now my Recursion Concept clear your teaching way Awesome mam ....
In the last problem, in the even part, it should be if(n==1) return x; Otherwise coz of the n==0 we get x^0=1 then x^1 will be equal to 1 and so on...
Thank you, mam very good explanation.
Without 3 variable, you can also use
You have explained one of the complex topic in a very smooth way. Very Thankful🥰
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
31:06 instead of sum+=i we can do (i==n+1) and then print sum then return.
I usually don't comment on videos but I have to say the explanation is mind-blowing
I cannot thank you in words🥰
काबिले तारीफ दीदी 🙏🙏🙏🙏🙏
You are great 😎
Didi ,recursion crystal clear ho gya . Thanks a lot shrada didi
Aman bhaiya c++ pe practice 500 questions Ki serie banvado please 🙏🙏🙏 garib ko placement lag jayegi
Babbar's 450 ques is best for placements👍
@@KaranKumar-vm2we Haan vahi solution bi chayie😅
@@KaranKumar-vm2we oh no oh no oh no no no..!
Abe kisi ke bhi DSA sheet utha kar kar le uske baad kitne bhi solve karte beth
@@KaranKumar-vm2weBhai Java ke liye questions kaha milega...
best video i ever show of recursion
i am trying to understand recursion from many resources but finally understand now.thanks
At 40:10
public class Main{
public static void printfact(int x , int fact) {
if(x == 0 || x== 1){
System.out.println(fact);
return ;
}
fact *= x ;
printfact(x-1 , fact);
}
public static void main(String[] args){
int x = 5 ;
int fact = 1 ;
printfact(x,fact);
}
}
Thank you so much, mam it's too good 👍 learning 📕 platform
public static int printSum(int n){
if(n ==0){
return 0;
}
else{
return n+ printSum(n-1);
}
public static void main(String args [ ] ){
int n =5;
int ans = printSum(n);
syso(ans);
}
An easy and better code for printing sum of n numbers using recursion
Amazing content. Everything is explained in a very easy to understand way. Thanks alot
Hello guys! I am from Pakistan. I am learning java from this channel and she is one of the best teachers on TH-cam . The way she explains it is exceptional. I found this channel very valuable
love from India bro
Pakistani not allowed get lost 🤬
Hate from india bro🔪
Lots of love to your lactures seriously now I am able to learn recursion otherwise I was thinking recursion is not my type 😂
Perfectly explained each question, last question was mind blowing!
the explanation is very simple .thank you so so much for this videos .
Thank you easy method to understand mam
You are one of the best online teacher. Thank you for making such videos.
Best lecturer in the world for me didi🙏♥️
You are greatest teacher..❣️
Sach me
Thank you so much for explaining recursion in such simple yet detailed manner.
Last question is so dengerious..Didi🙂dimag nehni chalapaya us type ke question par...but rest of the question are easy to catch...thanks for sharing this type of difficulty label class...❤❤❤
I am in Coding Ninja Coding boot camp, but they teach like, only doing there job. For understand the fundamentals and concepts, I always prefer Apn college. Very Easy explanation ❤❤❤
thank you so much didi for this wonderful lecture.
thanku mam for exlpaning this diffult concept in such easy words!!!!!!!
your logic building way mam
Very Helpful
Thank you so much for explaining recursion in such a simple yet detailed manner.
your teaching is FAB . I will join college this year and i am looking forward to watch your videos through my whole journey. Thank you for this amazing playlist didi..
Very very easy concept 😊
Thank u so much. May u get lot of success and happiness in your life.
Thanks to this quality lectures even a non-tech begineer like me can understand complex concepts in very simple and instructive way.
best recursion video ever 👌👌
Finally, I understand Recursion thankyou @apna college
Maza aa gya didi recursion me toh😊
really informative...the way you are teaching to students its quite commendable .hats off
amazing way of learning in youtube 😊
Hello sister we need more videos like this java.... Thank you for your previous videos
22:56 System.out.println(6-n)
Just understood the power of stack🤯
Thank you
In last question Calculate power:
calcPower(x,n/2) was called twice, this can be optimised by storing the value in a variable.
Overall very good video.
Thankyou!
she teaches so well finally i got the top playlist for dsa in java,thank you didi
I have learned first time , I have to build a great understanding of recursion thank u very much and also keep it up,
That was crystal clear didi💗!!
the concept was explained very well thank you mam
thanks allot mam,
mene coching ki paid class leave krke aapka video dekha tab jaa ke recursion samajh aaya
thank you madam your teaching method is very good
In last and second last problem we can change first base case to... If(n==1) return x;... So that no of levels and value of n remains same...
Hi shardha
in function calpower we dont require to chk the condition for x since we are not editing it also the height of the stck can be reduced by adding a basecase of if(n==1) return x; so the height will be n-2 here pls correct if anything wrong Thankyou
27:40 points
39:38 parameters work base
Awesome teaching style. Great illustrations. Keep it up. 👍🤘🙂
th-cam.com/video/qWx5ZAFkSfk/w-d-xo.html
Mam you are amazing 🙌🙏❤
Great video. Thank you so much for sharing,