Thanks for uploading this video. I was looking for the basic problems on recursion from yesterday to get started on dynamic programming. I could not find a single video which starts from the basic. Most of them are either at a high level, or just algo, or just theory or simply avoid explaining the basics. This video definitely helped me to get started on this topic of recursion.
For base and power question, the base condition you have mentioned is incorrect. You should use if power==0, return 1 as the base condition. Else 2 to the power 0 which is 1 will throw an error in your code
I am learning recursive functions in Haskell and I like the way to connect the same functions topic in both languages. I enjoyed your videos, I have to practice data Structures. Do you have apache Spark video materials, or Scala recursion topic? Kind regards.
For 8: This should be good enough right why bother about all those nested loops? public static int countDigit5(int num) { if(num < 5) { return 0; } else { if(num%10 == 5) { return 1 + countDigit5(num/10); } else { return countDigit5(num/10); } } }
try to make dry run of this program. return is written to stop method calling when index reaches to zero. otherwise it will keep on calling itself and will never stop. if condition is called base case and base case must return something, null, 0 or any value.
Every return 2 sums up. catEyes(cats-1) is a counter like i-- , everytime it decrements - return 2 happens, so for every cat there are 2 eyes. It doesn't make sense to use recursion in this example though, but if you're thinking just make it return 2 * catEyes(cats) that would cause stack overflow due to infinite recursions. You need -1 to reach the base condition of 0 and exit the function.
Thanks for uploading this video. I was looking for the basic problems on recursion from yesterday to get started on dynamic programming. I could not find a single video which starts from the basic. Most of them are either at a high level, or just algo, or just theory or simply avoid explaining the basics. This video definitely helped me to get started on this topic of recursion.
this video was so helpful. could you do another set of problems involving strings and arrays?
perfect!!!!! it helps me a lot when i am stucked totally with recursion
Really benefitted from this video
Especially pausing and doing the problem first then checking my answer
Thanks a lot great video
Please show the dry run of each question , so that the logic will be cleared .
this video was really helpfull to me, thanks a lot, now I can understand a little bit more about recursion.
For base and power question, the base condition you have mentioned is incorrect. You should use if power==0, return 1 as the base condition. Else 2 to the power 0 which is 1 will throw an error in your code
sir plz tell me how can I write a java program using words
{J, O, K,E,R} to show it's all possible pattern and also count total no. of words formed.
study combinations in maths and use that logic here.
plz explain return 2+catEyes(cats-1) .
each cat has 2 eyes so --> +2
when calling the function again we need reduce 1 cat as we have counted its eyes by adding 2 --> cats -1
I am learning recursive functions in Haskell and I like the way to connect the same functions topic in both languages. I enjoyed your videos, I have to practice data Structures. Do you have apache Spark video materials, or Scala recursion topic? Kind regards.
Thank you very much the video is very helpful even tho i wished you had some examples with array
Thank you! Your explanations are amazingly clear and the examples really help solidify the theory that we have learnt.
Thank you for taking the time to do this great great video... Fantastic lesson about recursion!
Bro this video was Ok but try to put some advance (how recursion works inside (for loop )) with step by step process
Way too many ads - destroying what could be the best recursion video on youtube.
For 8: This should be good enough right why bother about all those nested loops?
public static int countDigit5(int num) {
if(num < 5) {
return 0;
} else {
if(num%10 == 5) {
return 1 + countDigit5(num/10);
} else {
return countDigit5(num/10);
}
}
}
If you'd get a dollar every time you said "All right?"...)
Nice video anyway, just what I needed.
thank you so much sir. amazing video for cs students
How can we print all the Fibonacci series till n instead of only nth position
Greater explanation thank you sir!!!!!!!!
sorry sir for disturbing u again and again.But what can I do videos r really awesome by viewing them I can't stop myself to ask doubts.
"Convert recursive algorithm to non recursive using rules for recursion " can you make video on it
Very helpful. Thanks
Can u explain the control flow of fibonacci series program?
share your email I will help you with the control flow or check this ruclips.net/video/B3U6LExgevE/видео.html&frags=pl%2Cwn
Excellent explanation. Thanks a lot
amazing video very helpful
Thank you so much 💕
Java ka koi apps hai kya sir
@ 35:47 I feel like you overcomplicated that one:
if(n==0)
return 0;
if (n%10 == 5)
return 1 + count5(n/10);
else
return count5(n/10);
Nvm, I see you were just trying to show nested if/else in the base and recursive case. Great video by the way!
What happens though if N is a number of 1-9 since you only made a stop for if n==0.
Or would 9/10 result in a 0 so it would hit the stop?
There is no problem actually
Very helpful man. Thanks
Great video! Various exercises in one video, thank you very much.
Thanks ☺️
Awais sir can you please show the back process of fibnocci series using recursion
Best recursion video!!
sir at 5:38 in recursion program to print no. why u have written return in 1st if loop . What is it's use in program.🙏🙏🙏
try to make dry run of this program. return is written to stop method calling when index reaches to zero. otherwise it will keep on calling itself and will never stop. if condition is called base case and base case must return something, null, 0 or any value.
man exiting condition is always mentioned 1st in the recursion so that function call is not triggered for wrong inputs
Very good sir explaned well
Can you please help me to understand a code ?
so helpful!
Hey .please increase your voice level
great video A++ thank you
THANK YOU SIRR!!
Why don't u explain it in detail . I mean how the code actually runs !!!
Everything was awesome.... except for the spelling of speakers🤣🤣
good speacher
15:30
explanation is not clear. Specially , return 2+catEyes(cats-1);
Every return 2 sums up. catEyes(cats-1) is a counter like i-- , everytime it decrements - return 2 happens, so for every cat there are 2 eyes. It doesn't make sense to use recursion in this example though, but if you're thinking just make it return 2 * catEyes(cats) that would cause stack overflow due to infinite recursions. You need -1 to reach the base condition of 0 and exit the function.
It would be good if you send source code
Don't be lazy, you can type all of it in 5min.
you best
I DO NOT GET NONTAIL RECURSION. These examples are so simple...
Cat problem was not recursion
Yeah it is, just it doesn't make sense to solve it with recursion when a simple * 2 will suffice, not even iteration is needed.
@@counterguardian6145 nigga he said that
But he's simply using as a practice problem
So we have to try to solve it using recursion
Please decrease the volume of your voice from next video, it is very loud.
45:39
[rikarion] xdddddddd