This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Qa dd'rouy Again  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please give me the simplest example of Recursion ... with basic definition of process(recursion) i am so confused about it .....
Waiting for response
Umair Uddin Qa dd'rouy
 
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A recursive method is simply one that calls itself. The simplest kind of recursion goes like this:

That's basically an infinite loop, although it leads to a side effect known as being "out of memory." You'll run out of memory because each time recurse() is called, the currently calling method has to be stored while it waits for the now-called recurse() to do its thing. Since there's no reason for recurse() to ever quit calling itself, it's just a matter of time before you blow up.
To avoid this, a recursive method specifies a condition that allows each called method to return to its calling method, until they're all resolved. For example:

This can be a bit of a mind-bender if you don't know how a process tracks the instructions that it runs, so just let it soak for a while.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is another example that shows how it can be usefull:
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!