I write codes at times. Whenever it comes to recursive thinking, my mind would go haywire. Especially when I try to step through the codes line by line, I often find myself getting lost when proceeding through the 'infinite' loop - infinite because I was never convinced.
Any tips to help me master the concept?
Three answers:
brilliant_moves
2013-08-15 09:26:28 UTC
Look up recursion in Wikipedia
2013-08-15 07:07:22 UTC
I had this same issue when I first too C programming. It is a abstract concept, and I still have problems with it sometimes. Its kind of like inception, its a function called inside a function inside a function... you get the point.
Basically recursion is a function, that is designed to call its self inside of the fuction. So if you make a function recursivly, you would define the function, and then inside of the function definition, call the function you are defining with different parameters. Then it will continue to call its self until it reaches the end. That you have to define inside the function. Thats the best I can do ya. I could draw out diagrams for you and go through funcitons if you were here but thats all I can do for typing. :P
2013-08-15 06:47:28 UTC
Look up recursion on google. Just do it. That will help you understand.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Search results for 'How to better grasp the concept of recursion?' (Questions and Answers)