No. In order to to understand recursion, you must first understand recursion. In order to understand recursion, you must first understand recursion .In order to understand recursion, you must first understand recursion . In order to understand recursion, you must first understand recursion . . . . . . . Constant loop
@@ExarchiasGhost yes but in order to understand what u asked...U need to ask urself what is recursion. Then understand recursion. Then understand recursion. Then understand recursion. *bloody loop*
I spent 3 semesters in computer science courses avoiding recursion like the plague. I have had only excellent teachers, but never nailed down the nuances that kept recursion confusing. Here I am, at 4 am the night before my final and you absolutely nailed it (it was the going back up concept, among other things). Progressing in this field can be difficult, and I am very thankful for your tutorials. You must love what you do!
Thank you :) Im very happy I was able to help. I worked as a programming architect for many years and one of my responsibilities was to train new hires. I always enjoyed doing that. While making these videos I imagine someone is standing behind me and learning. It makes me very happy to be able to help
I'm extremely grateful to be able to help in what ever way I can. Thankfully there are thousands of people that love to teach and that number will continue to grow. Eventually a complete education on every topic will be available for free to all across the globe.
Ich bin froh, es hat euch gefallen. Ich hoffe, ich machte es leicht, in diesem Video zu verstehen? Ich liebe es, komplizierte Themen leicht zu verstehen. Vielen Dank für immer die Zeit nehmen, um Sie wie die Videos sagen. Ich schätze, dass :)
I have been programming for over 25 years. In the beginning I studied constantly, but now I pretty much have my system and I follow it. I write code for about 1/2 the day 7 days a week. I keep up on the new technologies, but I mainly still use Java, C, C++, PHP and JavaScript for everything. I am very lucky in that I can decide what projects I want to work on, so I'm always excited to program. I mainly write programs with a ton of math, or simulations
I know this video is from 2013 but I couldn't wrap my head around recursion at all until I watched this. I'm a freshman in college with a great teacher but she wasn't able to explain it this well. Thanks so much! :D
This is my first year in college and I'm majoring in computer science. Our professor just tried to teach us about recursion but didn't do it very well and left the class thinking "WHAT JUST HAPPENED. WHY DID THAT WORK!?!?!", myself included. I've had an issue where I haven't been able to comment on videos for a year and was too lazy to fix it. This video was so helpful, and I'm so grateful, that I got off my lazy ass and figured out how to fix my problem just so I could comment on this video and thank you. Thank you for teaching me about this confusing concept!! You're the best!
Thank You. I was so afraid of recursion and the fact that i couldn't come up myself how to do factorials using recursion, but when I saw the third example I made it myself, so easy :D I think this are the best intermidiate/advanced java tutorials on the internet.
Wow thank you so much. My data structures text book didn't explain at all how this works. I ran an example in the debugger and was extremely confused why it went "back up" once it hit the base case. You cleared it up in the first 2 minutes. Thank you!
I actually came here because I was trying to make a merge sort algorithm and wanted a better understanding of recursion before starting. Thanks for covering merge sort too very helpful.
I think it's worth mentioning that this implementation of merge sort, with in-place index shifting on an array, is O(n^2). Merge sort is usually taught using substructures and is O(nlg(n)).
Pick projects that are fun. I only work on fun projects. When I was young and just starting with programming I made games and nothing else because games are fun to make. Games also require you to know many things. Don't try to memorize because that will just bore you. Instead come up with an idea, copy and paste others code and then just fix the errors. Once you get past the basics programming is very fun
You are awesome dude. Thank you so much for doing these. I'm starting to realize the necessity for self-teaching in the computer science major, and these help loads.
Hi Derik- I just wanted to say thank you for all your fantastic videos- they have really assisted me in my studies! No need to sit and read the textbook anymore!
I think I have a pretty intelligent community. Many of them stayed with me through design patterns and refactoring. If they can handle those topics recursion should be a breeze. You are right though that things can go crazy if they try to use the merge sort on a 10,000 item array :)
Caro Coach, La tendenza sarà in vita fino a quando si ottiene il tutorial grandi. Tu sei la ragione per la nostra capacità di migliori. Più potenza per voi. grazie
Actually, for triangular numbers, you can calculate it like this: public int getTriNum(int num) { return (num + (num * (num - 1) / 2)); } Or a bit more understandably: public int getTriNum(int num) { for(int i = 1; i
Has anybody else covered Java as well as you have? I remember watching one of your videos at the end of 2013 (for easy code involving HTML / CSS, and so on). I'm becoming obsessed with code and I want everything out of it.
I make custom applications for a small group of people. Mainly tools they use for investing. I also make apps for professors (research stuff). On top of that I run 8 online stores. Yes, it is great to be in a position to turn down business. For 4 years I had to take on every project and it sucked. I'll never put myself in that position again
Thank you very much :) Your teacher probably just doesn't like his job. I think the worst thing in the world is being forced to work in a job that one dislikes. I'll do my best to fill in the gaps that your teacher misses
Absolutely you should go! I could have continued, but I was working to pay my way. I got a few scholarships and I refused to take out loans. That is the main reason it was hard for me. I also didn't like the speed and I didn't feel like I was learning everything. College just isn't for everyone, but if I could have afforded to go to a good school for free, or inexpensively I definitely would have gone
If it goes too fast, you can pause the video and/or go back. Also, watching other videos on related topics like triangular numbers, etc, can help. I do the same.
It is actually pretty easy after a while. Is it worth it? That depends on what you mean by worth I guess :) I very much enjoy helping people and most people are extremely nice.
Thanks Derek, for one more illustrative tutorial! Before, I only had a kind of vague idea of recursion but now, I believe to understand it better. I'm looking forward to the sorting methods...
In the box model representation of the first problem (getTriNum) , wouldn't the return of the call getTriNum(1) simply yield the result of 1 rather than the result of the computation of 1 + getTriNum(1 - 1) since the method checks to see if n is equal to 1. If n == 1, there is no recursive call made, the method just returns 1.
You sound like Andy Bernard from the Office. Also, thanks for the video explaining recursion, this makes a lot more sense to me seeing what happens at each step :)
MegaGangsta4life I'm sorry to hear that. I always considered failing to be a good thing though because I then focus and move on. Keep at it and you'll do fine. If I can do this stuff so can you. I wish you all the best :)
Derek Banas I am an indie game developer, and I program a lot, I took AP Comp Sci because I thought it would help me. I was wrong xD I fail all the test and copy/paste other people`s code just to get a B in the class :P I enjoy programming and Ive made 3 games, I just despise my class. But your tutorials do help a lot
MegaGangsta4life Keep at it. When the student fails it isn't the fault of the student it is the fault of the teacher. Never let the failings of others define you. For some reason in this day in age teachers believe their job is to force students to fail. I think that is lazy. I see no reason to idolize lazy people either :) Only through failure do we appreciate success. The only people that deserve success are those who struggle to find it.
In certain situations recursion makes for dramatically shorter and actually easier to understand code. One common use is with web crawlers. You go to the site and find all the links. You then follow all those links to other completely different pages. This continues forever until you finally come to the end of the line and cycle back to the original page. This would be impossible to do with normal looping, but recursively it is quite straight forward.
Hey Derek, how are you doing? Is is possible to change your code to implement towers of Hanoi and build a trace just like the ones you did for factorial and triangular number? By the way, one of the best videos on this subject available ;)
Thanks for the help. Its unfortunate that after paying thousands of dollars of tuition to universities, they can only provide us with professors who are incapable of teaching, and we have to come to places like CZcams and hope that there are better instructors out there willing to help us out for 'free'.
At 2:44 for method 3, shouldn't it simply be "Method 3: number = 1 : return 1"? Since if num == 1, according to the method, it should return a 1. So "1 + getTriNum(1-1)" is unnecessary? Also, "getTriNum(1 - 1)" should never happen because if num == 1, then the else statement is not executed.
Mimi najua lugha ya programu nyingi lakini wachache sana zinazozungumzwa. Mimi kamwe kuongea na watu katika ulimwengu halisi hivyo mimi kidogo kutumia kwa ajili yao :)
Thanks sir. The explanation of the recursive methods was very good and it made it easier for me to understand that. Though, the later portion of the video was too complicated for me. Thank you for the video. I guess I will also use the same way as you to teach my viewers about recursion. Cheers 👏
this helped to some extent, but im unable to apply myself in order to trace the recursion algorithm for Towers Of Henoi. It'd be nice to have you explain that.
Do something like converting the number parameter to a string. Then use two conditionals. If the first character is not 0, call the function with the parameter as the number string without the first digit. Else, return 1+ function without the first digit in the string. Remember to cast this string back to an int. Your base case should probably take into consideration if number
How to write a recursive method that prints a large Z composed of smaller X's with a given "width", n which guaranteed to be odd? . and another recursive method that prints a session of dropping the cards with C's and S's? For example if you drop it 4 times in a given session, all possible ways to drop it
Hallo liebe Trainer, Das ist eine schwierige Thema zu lernen. Dank Ihnen wird es nicht ein Problem in der Zukunft sein. Ich bin froh, wieder Gold zu gewinnen :) :) Ich bin der aredent Schüler von Ihnen. vielen Dank
hello sir Derek. I have this in my applied data structure class and I can't really explain the output of the getFactorial part that you did. I mean, yes, I understand how it works like for n = 3, the 3*2*1 = 6 is the factor of 3. But for the output, I can't cope up how to explain it to myself. This: Method 3 // Yes, first output when getFactorial() called Method 2 // appear because first if statement is false, 2nd statement is true when "int result = number * getFactorial(number - 1);" called? correct or no? Method 1 // appear when "int result = number * getFactorial(number - 1);" called? correct or no? Returned 1 // appear when "int result = number * getFactorial(number - 1);" called because the last number is the result of (2-1)? Return 2 : 2 * getFactorial(2 - 1)// what now? Return 6 : 3 * getFactorial(3 - 1) // and what now for this line? T_T please help me
The best thing to do is to print out the changing values as the program runs. That way you'll see everything being built toward the final solution. Be as descriptive as possible with the output. You'll get it
Hi Derek, I think the first two "int" arguments in the "printHorzArray" method are not necessary. Could you explain why you put them there? I think you must have some good reasons for that.
i didn't get it when i see "else" i do whats under it then continue on . i dont go back to "if" because the "if" condition didnt match in the first place.
Your videos are so good! It's just sad that you're on the internet making videos for free while my nutjob for a teacher actually gets paid for being horrible at his job.
Learn in One Videos for Every Programming Language
Subscribe to Bookmark them: bit.ly/2FWQZTx
C++ : czcams.com/video/Rub-JsjMhWY/video.html
Python : czcams.com/video/N4mEzFDjqtA/video.html
Java : czcams.com/video/n-xAqcBCws4/video.html
PHP : czcams.com/video/7TF00hJI78Y/video.html
MySQL : czcams.com/video/yPu6qV5byu4/video.html
JavaScript : czcams.com/video/fju9ii8YsGs/video.html
C# : czcams.com/video/lisiwUZJXqQ/video.html
HTML5 : czcams.com/video/kDyJN7qQETA/video.html
CSS3 : czcams.com/video/CUxH_rWSI1k/video.html
JQuery : czcams.com/video/BWXggB-T1jQ/video.html
TypeScript : czcams.com/video/-PR_XqW9JJU/video.html
ECMAScript : czcams.com/video/Jakoi0G8lBg/video.html
Swift : czcams.com/video/dKaojOZ-az8/video.html
R : czcams.com/video/s3FozVfd7q4/video.html
Haskell : czcams.com/video/02_H3LjqMr8/video.html
Handlebars : czcams.com/video/4HuAnM6b2d8/video.html
Bootstrap : czcams.com/video/gqOEoUR5RHg/video.html
Rust : czcams.com/video/U1EFgCNLDB8/video.html
Matlab : czcams.com/video/NSSTkkKRabI/video.html
Arduino : czcams.com/video/QO_Jlz1qpDw/video.html
Crystal : czcams.com/video/DxFP-Wjqtsc/video.html
Emacs : czcams.com/video/Iagbv974GlQ/video.html
Clojure : czcams.com/video/ciGyHkDuPAE/video.html
Shell : czcams.com/video/hwrnmQumtPw/video.html
Perl : czcams.com/video/WEghIXs8F6c/video.html
Perl6 : czcams.com/video/l0zPwhgWTgM/video.html
Elixir : czcams.com/video/pBNOavRoNL0/video.html
D : czcams.com/video/rwZFTnf9bDU/video.html
Fortran : czcams.com/video/__2UgFNYgf8/video.html
LaTeX : czcams.com/video/VhmkLrOjLsw/video.html
F# : czcams.com/video/c7eNDJN758U/video.html
Kotlin : czcams.com/video/H_oGi8uuDpA/video.html
Erlang : czcams.com/video/IEhwc2q1zG4/video.html
Groovy : czcams.com/video/B98jc8hdu9g/video.html
Scala : czcams.com/video/DzFt0YkZo8M/video.html
Lua : czcams.com/video/iMacxZQMPXs/video.html
Ruby : czcams.com/video/Dji9ALCgfpM/video.html
Go : czcams.com/video/CF9S4QZuV30/video.html
Objective C : czcams.com/video/5esQqZIJ83g/video.html
Prolog : czcams.com/video/SykxWpFwMGs/video.html
LISP : czcams.com/video/ymSq4wHrqyU/video.html
Express : czcams.com/video/xDCKcNBFsuI/video.html
Jade : czcams.com/video/l5AXcXAP4r8/video.html
Sass : czcams.com/video/wz3kElLbEHE/video.html
Can u pls speak slowly
It's very very difficult to understand you because you speak so so fast
In order to understand recursion, you must first understand recursion
That's funny :)
No. In order to to understand recursion, you must first understand recursion. In order to understand recursion, you must first understand recursion
.In order to understand recursion, you must first understand recursion
. In order to understand recursion, you must first understand recursion
.
.
.
.
.
.
.
Constant loop
@@anugrahgeorge8293 do you mean recursion?
@@ExarchiasGhost yes but in order to understand what u asked...U need to ask urself what is recursion. Then understand recursion. Then understand recursion. Then understand recursion. *bloody loop*
@@anugrahgeorge8293 ok but I will start from the recursion because when I tried with recursion I got results from a recursion. :)
I spent 3 semesters in computer science courses avoiding recursion like the plague. I have had only excellent teachers, but never nailed down the nuances that kept recursion confusing. Here I am, at 4 am the night before my final and you absolutely nailed it (it was the going back up concept, among other things). Progressing in this field can be difficult, and I am very thankful for your tutorials. You must love what you do!
I absolutely love programming :) I'm very happy that I was able to clear up a very often confusing topic. That is always the goal of each video.
Where are you working now, after 4 years?
This was an amazing explanation! Im right there with you!
I spent so long on the first recursive function thinking he passed in 1.6
Omggg, I was trying to figure out too and how he went from 1.6 to 2.5 lol
Me too :)
Sameee hahah
SAME
Thank you :) Im very happy I was able to help. I worked as a programming architect for many years and one of my responsibilities was to train new hires. I always enjoyed doing that. While making these videos I imagine someone is standing behind me and learning. It makes me very happy to be able to help
I'm extremely grateful to be able to help in what ever way I can. Thankfully there are thousands of people that love to teach and that number will continue to grow. Eventually a complete education on every topic will be available for free to all across the globe.
Ich bin froh, es hat euch gefallen. Ich hoffe, ich machte es leicht, in diesem Video zu verstehen? Ich liebe es, komplizierte Themen leicht zu verstehen. Vielen Dank für immer die Zeit nehmen, um Sie wie die Videos sagen. Ich schätze, dass :)
I have been programming for over 25 years. In the beginning I studied constantly, but now I pretty much have my system and I follow it. I write code for about 1/2 the day 7 days a week. I keep up on the new technologies, but I mainly still use Java, C, C++, PHP and JavaScript for everything. I am very lucky in that I can decide what projects I want to work on, so I'm always excited to program. I mainly write programs with a ton of math, or simulations
Thank you very much :) Ill be making java related tutorials for quite a bit longer. I hope you enjoy them
I just watched 3 tutorials, got absolutely nowhere, and within the 1st 50 seconds of this video you explained it! Derek Banas > All
***** Thank you :) I'm happy I could help.
Not as happy as I am mate. Thankyou 😌
I know this video is from 2013 but I couldn't wrap my head around recursion at all until I watched this. I'm a freshman in college with a great teacher but she wasn't able to explain it this well. Thanks so much! :D
I'm very happy I could help :)
Thank you :) I try to make the best videos I can. I'm glad you liked it
wow, every time I struggle with x/y concept there is a video in your channel that helps me understand it 100%... Again, thank you Derek!!!!!
Thank you for the compliment :) I'm happy I can help
I'm glad it helped :) I figured if I provided enough walkthroughs that it would make sense
This is my first year in college and I'm majoring in computer science. Our professor just tried to teach us about recursion but didn't do it very well and left the class thinking "WHAT JUST HAPPENED. WHY DID THAT WORK!?!?!", myself included. I've had an issue where I haven't been able to comment on videos for a year and was too lazy to fix it. This video was so helpful, and I'm so grateful, that I got off my lazy ass and figured out how to fix my problem just so I could comment on this video and thank you. Thank you for teaching me about this confusing concept!! You're the best!
iNewbieNick Thank you very much for all the nice compliments :) I appreciate you taking the time to tell me that I helped. You're very welcome.
Thank You. I was so afraid of recursion and the fact that i couldn't come up myself how to do factorials using recursion, but when I saw the third example I made it myself, so easy :D I think this are the best intermidiate/advanced java tutorials on the internet.
I'm happy that I could clear it up. I don't know why so many people struggle with teaching this topic?
Need to concentrate extremely hard but very well explained.
+Justin Li Thank you :)
Is it because of the accent? hehehe
You are the god father of programming tutorials!
+Nicolas Mazorra Thank you for the nice compliment :)
Wow thank you so much. My data structures text book didn't explain at all how this works. I ran an example in the debugger and was extremely confused why it went "back up" once it hit the base case. You cleared it up in the first 2 minutes. Thank you!
Thank you :) I'm glad I could help
I actually came here because I was trying to make a merge sort algorithm and wanted a better understanding of recursion before starting. Thanks for covering merge sort too very helpful.
Thank you :) I'm glad it heped
I think it's worth mentioning that this implementation of merge sort, with in-place index shifting on an array, is O(n^2). Merge sort is usually taught using substructures and is O(nlg(n)).
Pick projects that are fun. I only work on fun projects. When I was young and just starting with programming I made games and nothing else because games are fun to make. Games also require you to know many things. Don't try to memorize because that will just bore you. Instead come up with an idea, copy and paste others code and then just fix the errors. Once you get past the basics programming is very fun
Just so you know the dashes confused me really bad as I thought they were minus signs
+Dan En Sorry about that
Well I'm very happy to help! I'm glad he likes his job at least :)
Just simply amazing. I believe college professors are experts in their fields of study, but some are not cut out to be a educator.
Thank you :) I'm happy I could help
Thank you :) I have a mile long list of algorithms in the works
You just earned a comment, a subscription, and a fan.
Thank you :)
You are awesome dude. Thank you so much for doing these. I'm starting to realize the necessity for self-teaching in the computer science major, and these help loads.
+Tom Reilly Thank you :) I'm happy I could help
I've used pretty much every language at one point or another.
Hi Derik- I just wanted to say thank you for all your fantastic videos- they have really assisted me in my studies! No need to sit and read the textbook anymore!
Hi, I'm very happy to hear that I could help. You're very welcome :)
Great! I'm glad I was able to make recursion make sense :)
I think I have a pretty intelligent community. Many of them stayed with me through design patterns and refactoring. If they can handle those topics recursion should be a breeze. You are right though that things can go crazy if they try to use the merge sort on a 10,000 item array :)
Thank you very much :) It is hard to work through the first time, but after you get it it makes sense. I'm very happy that I've been able to help
Caro Coach,
La tendenza sarà in vita fino a quando si ottiene il tutorial grandi.
Tu sei la ragione per la nostra capacità di migliori.
Più potenza per voi.
grazie
Actually, for triangular numbers, you can calculate it like this:
public int getTriNum(int num) {
return (num + (num * (num - 1) / 2));
}
Or a bit more understandably:
public int getTriNum(int num) {
for(int i = 1; i
Thank you for sharing :) I was just looking for an excuse to use recursion
I program with Eclipse Indigo. I record the screen with Camtasia 2. I edit everything with iMovie. My microphone is a simple iPod headphone mic.
Has anybody else covered Java as well as you have? I remember watching one of your videos at the end of 2013 (for easy code involving HTML / CSS, and so on). I'm becoming obsessed with code and I want everything out of it.
Mez Cop Thank you for the nice compliment :) I guess I have the most popular Java videos. I'm very proud of that!
after watching the first example i understood it so well, my teacher spent a whole class on recursion understood nothing thanks
I make custom applications for a small group of people. Mainly tools they use for investing. I also make apps for professors (research stuff). On top of that I run 8 online stores. Yes, it is great to be in a position to turn down business. For 4 years I had to take on every project and it sucked. I'll never put myself in that position again
Thank you very much :) Your teacher probably just doesn't like his job. I think the worst thing in the world is being forced to work in a job that one dislikes. I'll do my best to fill in the gaps that your teacher misses
I learn more from these videos than I do in my Uni courses. Thanks!
JackRabbit Thank you :) I'm happy I could help.
same for me lol
fantastic, got it in one go. Perfectly paced.
Vaibhav Namburi Thank you :)
Very impressed with the quality of these videos! I'm a software engineering student, and these videos are great helpers!
+Megan Doherty Thank you :) I'm happy that you like them.
Because if you have num + method(num-1) and if num = 1, then 1 + (1-1) = 1.
Absolutely you should go! I could have continued, but I was working to pay my way. I got a few scholarships and I refused to take out loans. That is the main reason it was hard for me. I also didn't like the speed and I didn't feel like I was learning everything. College just isn't for everyone, but if I could have afforded to go to a good school for free, or inexpensively I definitely would have gone
You earned another subscriber! Thank you so much! In only just 2 mins i did understand it more than my purchased course in Udemy! Thank you very much!
Thank you very much :) Happy I could help
That will be covered after my next video on the shell and quick sort :)
Grazie per le gentili parole. Io continuerò a fare del mio meglio
Derek thank you so much. CZcams is awesome because of the content creators likes you.
Thank you for the nice compliment :)
wow, you're first example was all I needed to break the barrier. Thanks!
u go way too fast :/
@@_________________404 LOL Liao was talking about her reply to the comment
If it goes too fast, you can pause the video and/or go back. Also, watching other videos on related topics like triangular numbers, etc, can help. I do the same.
Уважаемый тренер,
Это мульти лингвизм становится серьезным :)
Спасибо, еще раз, за все, что вы делаете.
It is actually pretty easy after a while. Is it worth it? That depends on what you mean by worth I guess :) I very much enjoy helping people and most people are extremely nice.
Thanks Derek, for one more illustrative tutorial! Before, I only had a kind of vague idea of recursion but now, I believe to understand it better.
I'm looking forward to the sorting methods...
I said to myself 'I wish I could double like' . Very nice video! You just got a new follower
Thank you very much :)
0:00 - 2:04, Explained it better than every other video
I wish I could explain stuff like this guy does.
Thanks for the compliment :)
Уважаемый тренер,
Это мульти лингвизм становится серьезным :)))
Спасибо, еще раз, за все, что вы делаете.
Thanks! It has helped me understand the devilish recursion.
In the box model representation of the first problem (getTriNum) , wouldn't the return of the call getTriNum(1) simply yield the result of 1 rather than the result of the computation of 1 + getTriNum(1 - 1) since the method checks to see if n is equal to 1. If n == 1, there is no recursive call made, the method just returns 1.
Thankyou for posting this! My lecture did not explain this well haha. Hopefully I can one day be able to make videos and help others!
crazypigs100 You're very welcome :) I'm glad I could help
That's really encourage me to keep on coding (must admit that it's really boring sometimes) Thks anyway!
You sound like Andy Bernard from the Office. Also, thanks for the video explaining recursion, this makes a lot more sense to me seeing what happens at each step :)
I'm happy it helped :) I get compared to Nard Dog all the time
you sound like andy from the office and i love it
+Clare MacDonald Thank you :) I hear that all of the time
I wish I found this guy at the beginning of my semester
I have a quiz tommorrow in APCS thx for the help xD
You're very welcome :) Good luck on your test.
I failed the test btw xD
MegaGangsta4life I'm sorry to hear that. I always considered failing to be a good thing though because I then focus and move on. Keep at it and you'll do fine. If I can do this stuff so can you. I wish you all the best :)
Derek Banas I am an indie game developer, and I program a lot, I took AP Comp Sci because I thought it would help me. I was wrong xD I fail all the test and copy/paste other people`s code just to get a B in the class :P I enjoy programming and Ive made 3 games, I just despise my class. But your tutorials do help a lot
MegaGangsta4life Keep at it. When the student fails it isn't the fault of the student it is the fault of the teacher. Never let the failings of others define you.
For some reason in this day in age teachers believe their job is to force students to fail. I think that is lazy. I see no reason to idolize lazy people either :) Only through failure do we appreciate success. The only people that deserve success are those who struggle to find it.
I'm watching this once every day until it's burnt into my brain.
I hope it helps :)
Great video, it moved a little fast for me, once you got into triangular numbers.
+Matthew Sagen Thank you :) Sorry about the speed
I'll see how soon I can cover that
Why we need recursion if we have "while" or "if" ? Can you explain?
In certain situations recursion makes for dramatically shorter and actually easier to understand code. One common use is with web crawlers. You go to the site and find all the links. You then follow all those links to other completely different pages. This continues forever until you finally come to the end of the line and cycle back to the original page. This would be impossible to do with normal looping, but recursively it is quite straight forward.
Thank you :) it is very gratifying to help people
I used to be able to speak German and could read and write Chinese and Japanese, but I've since forgotten most of it
Thank you :) That is very kind.
Hey Derek, how are you doing? Is is possible to change your code to implement towers of Hanoi and build a trace just like the ones you did for factorial and triangular number? By the way, one of the best videos on this subject available ;)
Thanks for the help. Its unfortunate that after paying thousands of dollars of tuition to universities, they can only provide us with professors who are incapable of teaching, and we have to come to places like CZcams and hope that there are better instructors out there willing to help us out for 'free'.
Thanks again Derek. Much clearer now.
Great I'm glad it helped :)
Yes that would be another candidate for recursion :)
At 2:44 for method 3, shouldn't it simply be "Method 3: number = 1 : return 1"? Since if num == 1, according to the method, it should return a 1. So "1 + getTriNum(1-1)" is unnecessary? Also, "getTriNum(1 - 1)" should never happen because if num == 1, then the else statement is not executed.
Mimi najua lugha ya programu nyingi lakini wachache sana zinazozungumzwa. Mimi kamwe kuongea na watu katika ulimwengu halisi hivyo mimi kidogo kutumia kwa ajili yao :)
Thanks sir. The explanation of the recursive methods was very good and it made it easier for me to understand that. Though, the later portion of the video was too complicated for me. Thank you for the video. I guess I will also use the same way as you to teach my viewers about recursion. Cheers 👏
I'm very happy that it helped :)
😄
You're very welcome :) Thank you
For every video tutorial I always Listen at 1.5x but you are the only one whose I hear at 0.75x
I do my best to not waste peoples time :)
Yeah but one thing Your explanation was brilliant
these is my dream lecture, Thanks for your patient help.
U r really excellent at coding so Can u tell me how much time do u spend to learn or writing code( or sth like that) a day?
A little fast for me but thanks for the video. Glad I have a pause button
I'm glad it helped :)
Thanks ....your voice is so catchy
.
Thank you for the compliment :)
you are awesome man. you're videos helped me re-learn these basic programming concepts! keep it up.
It would help me so much if you did a real life example with out using factorials and triangular numbers
Its time for another "Good Idea / Bad Idea"
Good Idea: using Recursion with stopping condition;
Bad Idea: Bad Idea:
exception stackoverflow;
this helped to some extent, but im unable to apply myself in order to trace the recursion algorithm for Towers Of Henoi.
It'd be nice to have you explain that.
how would you call a recursion function that returns the number of zero digits in the non-negative number that someone entered?
Do something like converting the number parameter to a string. Then use two conditionals. If the first character is not 0, call the function with the parameter as the number string without the first digit. Else, return 1+ function without the first digit in the string. Remember to cast this string back to an int. Your base case should probably take into consideration if number
How to write a recursive method that prints a large Z composed of smaller X's with a given "width", n which guaranteed to be odd?
.
and another recursive method that prints a session of dropping the cards with C's and S's? For example if you drop it 4 times in a given session, all possible ways to drop it
Hallo liebe Trainer,
Das ist eine schwierige Thema zu lernen.
Dank Ihnen wird es nicht ein Problem in der Zukunft sein.
Ich bin froh, wieder Gold zu gewinnen :) :)
Ich bin der aredent Schüler von Ihnen.
vielen Dank
can u tell me how to sum a fibonacci series by recursion only in java... please
hello sir Derek. I have this in my applied data structure class and I can't really explain the output of the getFactorial part that you did. I mean, yes, I understand how it works like for n = 3, the 3*2*1 = 6 is the factor of 3. But for the output, I can't cope up how to explain it to myself. This:
Method 3 // Yes, first output when getFactorial() called
Method 2 // appear because first if statement is false, 2nd statement is true when "int result = number * getFactorial(number - 1);" called? correct or no?
Method 1 // appear when "int result = number * getFactorial(number - 1);" called? correct or no?
Returned 1 // appear when "int result = number * getFactorial(number - 1);" called because the last number is the result of (2-1)?
Return 2 : 2 * getFactorial(2 - 1)// what now?
Return 6 : 3 * getFactorial(3 - 1) // and what now for this line? T_T please help me
The best thing to do is to print out the changing values as the program runs. That way you'll see everything being built toward the final solution. Be as descriptive as possible with the output. You'll get it
It's excelent explained, but all that non-using code and the comments are confusing me so much. Still a great video.
Thank you :) Sorry if I got off track a bit
Hi Derek, I think the first two "int" arguments in the "printHorzArray" method are not necessary. Could you explain why you put them there? I think you must have some good reasons for that.
i didn't get it
when i see "else" i do whats under it then continue on .
i dont go back to "if" because the "if" condition didnt match in the first place.
nice explanation Can you also create a tutorial on using recursion in trees where recusrion is used more than once in a method?
Thank you :) I'll see what I can do
Your videos are so good! It's just sad that you're on the internet making videos for free while my nutjob for a teacher actually gets paid for being horrible at his job.