wood burning stoves*
The moose likes Beginning Java and the fly likes Recursion tracing help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Recursion tracing help" Watch "Recursion tracing help" New topic
Author

Recursion tracing help

akshitha Akki
Greenhorn

Joined: Aug 03, 2012
Posts: 24



Can anyone help me in tracing the recursion program?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

It's hard to offer help when you don't ask a more specific question.

However, in general what you can do to help follow the recursion is to include an indication of how deep you are.

For example:




And then of course adding or changing the output to show you whatever you're not understanding.
akshitha Akki
Greenhorn

Joined: Aug 03, 2012
Posts: 24
Thanks Jeff. The way to trace a program you have provided helped me a lot.I also did a hand trace as well to get more clarity.
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Yes, a hand trace is always advisable. It can get messy fast in the case of recursion though. That's where the printouts come in.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Recursion tracing help
 
Similar Threads
Recursion
Finding anagrams in a dictionary file using pre-fixes
substring
recusion again.
Scrambling Words